akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;


int keta(int N){
    
    int ans = 0;
    while(N){
        ans += N%10;
        N /= 10;
    }
    
    return ans;
}

int main(){

    int N;
    int sum_min = INT_MAX;
    cin >> N;
    
    for(int A = 1; A < N; A++){
        int B = N - A;
        
        sum_min = min(sum_min, keta(A) + keta(B));
    }
    
    cout << sum_min << endl;
    

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
 
using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 60;
const int INF = 1e9 + 7;

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

    ll mp[10][10];
    rep(i, 10)rep(j, 10)cin >> mp[i][j];

    rep(k, 10)rep(i, 10)rep(j, 10){
        mp[i][j] = min(mp[i][j], mp[i][k] + mp[k][j]);
    }

    ll ans = 0;
    rep(i, h)rep(j, w){
        ll a;
        cin >> a;
        if(a >= 0)ans += mp[a][1];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

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

int main() {
	ll n, d, x, a[110], ans = 0;
	cin >> n >> d >> x;
	repi(i, 0, n) rd(a[i]);
	repi(i, 0, d) {
		repi(j, 0, n) if (i%a[j] == 0) ans++;
	}
	wrln(ans + x);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <climits>
#include <vector>

using namespace std;

int main() {
  int N, M, X, Y;
  cin >> N >> M >> X >> Y;

  int xmax = -1, ymin = INT_MAX, tmp;
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    if (tmp > xmax) { xmax = tmp; }
  }
  for (int j = 0; j < M; j++) {
    cin >> tmp;
    if (tmp < ymin) { ymin = tmp; }
  }

  for (int z = X + 1; z <= Y; z++) {
    // cout << z << " in? (" << xmax << "," << ymin << "]" << endl;
    if (xmax < z && z <= ymin) {
      cout << "No War" << endl;
      return 0;
    }
  }
  cout << "War" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <initializer_list>
#include <string>
#include <map>
using namespace std;

#define int long long
#define INF 0x3f3f3f3f

signed main()
{
    map<string, int> mp;
    int N;
    cin >> N;
    vector<string> s(N);
    for (int i = 0; i < N; i++)
    {
        cin >> s[i];
        mp[s[i]]++;
    }

    int M;
    cin >> M;
    vector<string> t(M);
    for (int i = 0; i < M; i++)
    {
        cin >> t[i];
        mp[t[i]]--;
    }

    int ans = 0;
    for (auto x : mp)
    {
        ans = max(ans, x.second);
    }
    cout << ans << endl;

    return 0;
}

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

int hug_cnt(string s){
    int cnt=0, LengthOfS=s.size();
    if(s.size()%2==0){
        for(int i=0;i<LengthOfS/2;i++){
            if(s.at(i)!=s.at(LengthOfS-1-i)){
                cnt+=1;
            }
        }
    }
    else{
        for(int i=0;i<(LengthOfS+1)/2;i++){
            if(s.at(i)!=s.at(LengthOfS-1-i)){
                cnt+=1;
            }
        }
    }
    return cnt;
}

int main(){
    string s; cin >> s;
    cout << hug_cnt(s) << endl;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $a, $b);
$a = ($a + 12) % 14;
$b = ($b + 12) % 14;
if ($a > $b) {
	echo 'Alice';
} elseif ($a < $b) {
	echo 'Bob';
} else {
	echo 'Draw';
}

Measured memory_bytes: 3452
l=[0]*3
for i in range(3):
    a=list(map(int,input().split()))
    l[i]=a
n=int(input())
bingo=[[1]*3 for _ in range(3)]
b=[]
for i in range(n):
    B=int(input())
    b.append(B)
for i in range(3):
    for j in range(3):
        if l[i][j] in b:
            bingo[i][j]=0
x=0
cnt1=0
cnt2=0
cnt3=0
nana1=0
nana2=0
for i in range(3):
    if sum(bingo[i])==0:
        print("Yes")
        x=1
        break
    cnt1+=bingo[i][0]
    cnt2+=bingo[i][1]
    cnt3+=bingo[i][2]
    nana1+=bingo[i][i]
    nana2+=bingo[i][2-i]
if x==0:
    if cnt1==0 or cnt2==0 or cnt3==0 or nana1==0 or nana2==0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

void solve() {
    int N;
    cin >> N;
    vi A(N);
    rep(i, N)cin >> A[i];

    ll ans = A[0] - 1;

    int P = 2;
    for (int i = 1; i < N; ++i) {
        if (P == A[i]) {
            P++;
        } else {
            ans += (A[i] - 1) / P;
        }
    }

    cout << ans << endl;
}

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

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

int main()
{
	int64_t n;
	cin >> n;
	vector<int64_t> as(n);
	for (auto &&a : as)
	{
		cin >> a;
	}

	vector<pair<int64_t, int>> ps(n);
	for (int64_t i = 0; i < n; i++)
	{
		ps[i] = {as[i], i};
	}

	sort(ps.begin(), ps.end());

	for (auto &&p : ps)
	{
		cout << p.second + 1 << ' ';
	}
	cout << endl;

	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

template <typename T>
T powmod(T n, T k, T mod) {
  if (k == 0) {
    return 1;
  } else if (k % 2 == 0) {
    return powmod(n * n % mod, k / 2, mod);
  } else {
    return n * powmod(n, k-1, mod) % mod;
  }
}

template <typename T>
T inv(T x, T mod) {
  return powmod(x, mod-2, mod);
}

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  const ll mod = 1e9 + 7;

  int N; cin >> N;
  vector<ll> X(N); REP(i, N) cin >> X[i];
  ll fact_N1 = 1;
  vector<ll> invs(N+1);
  invs[0] = invs[1] = 1;
  FOR(i, 2, N + 1) {
    if (i <= N-1) fact_N1 = (fact_N1 * i) % mod;
    invs[i] = inv<ll>(i, mod);
  }
  ll ans = 0;

  REP(i, N-1) {
    if (i > 0) ans += (1 - invs[i+1] + mod) * X[i] % mod;
    ans %= mod;
    if (i < N-2) ans += (-1 + invs[N-i-1] + mod) % mod * X[i] % mod;
    ans %= mod;
    ans += (X[N-1] - X[i]) * invs[N-i-1] % mod;
    ans %= mod;
  }
  cout << (ans * fact_N1 % mod) << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  int n;cin>>n;
  string a,b,c;cin>>a>>b>>c;

  int ans=0;
  rep(i,n){
    if(a[i]==b[i]&&b[i]==c[i]){
      //pass
    }else if(a[i]!=b[i]&&b[i]!=c[i]&&c[i]!=a[i]){
      ans+=2;
    }else{
      ans++;
    }
  }

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






Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if b==100:
        b=101
    print((100**a)*b)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <climits>
#include <cfloat>

using namespace std;

//start of 0uts1de's library

int cin_int_arr(vector<int>& arr){
    for (int i = 0; i < arr.size(); ++i){
        cin >> arr.at(i);
    }
    return 0;
}

int cin_int_arr(vector<int>& arr, int n){    //overload
    for (int i = 0; i < n; ++i){
        cin >> arr.at(i);
    }
    return 0;
}

int cin_double_arr(vector<double>& arr){
    for (int i = 0; i < arr.size(); ++i){
        cin >> arr.at(i);
    }
    return 0;
}

int cin_double_arr(vector<double>& arr, int n){    //overload
    for (int i = 0; i < n; ++i){
        cin >> arr.at(i);
    }
    return 0;
}


int cout_int_arr(vector<int>& arr){
    for (int i = 0; i < arr.size(); ++i){
        cout << arr.at(i) << endl;
    }
    return 0;
}

int cout_int_arr(vector<int>& arr, int n){    //overload
    for (int i = 0; i < n; ++i){
        cout << arr.at(i) << endl;
    }
    return 0;
}

int cout_double_arr(vector<double>& arr){
    for (int i = 0; i < arr.size(); ++i){
        cout << arr.at(i) << endl;
    }
    return 0;
}

int cout_double_arr(vector<double>& arr, int n){    //overload
    for (int i = 0; i < n; ++i){
        cout << arr.at(i) << endl;
    }
    return 0;
}


int max_int_arr(std::vector<int>& arr, int mode = 0){    //0 -> data  1 -> index
    int maxVal = INT_MIN;       //min of int
    int maxIndex = 0;
    for (int i = 0; i < arr.size(); ++i){
        if (arr.at(i) > maxVal){
            if (mode == 0){
                maxVal = arr.at(i);
            }
            else if (mode == 1){
                maxVal = arr.at(i);
                maxIndex = i;
            }
            else{
                cout << "Invalid mode." << endl;
                return -1;
            }
        }
    }
    if (mode == 0){
        return maxVal;
    }
    else if (mode == 1){
        return maxIndex;
    }
    return -1;
}

double max_double_arr(std::vector<double>& arr, int mode = 0){    //0 -> data  1 -> index
    double maxVal = -DBL_MAX;       //min of double
    int maxIndex = 0;
    for (int i = 0; i < arr.size(); ++i){
        if (arr.at(i) > maxVal){
            if (mode == 0){
                maxVal = arr.at(i);
            }
            else if (mode == 1){
                maxVal = arr.at(i);
                maxIndex = i;
            }
            else{
                cout << "Invalid mode." << endl;
                return -1;
            }
        }
    }
    if (mode == 0){
        return maxVal;
    }
    else if (mode == 1){
        return maxIndex;
    }
    return -1;
}

//end of 0uts1de's library

int main(){
    int n;
    cin >> n;
    cout << "Christmas";
    while (n != 25){
        cout << " Eve";
        ++n;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n, t;
  cin >> n >> t;
  vector<pair<int, int>> v(n);
  for(int i=0; i<n; i++) {
    int a, b;
    cin >> a >> b;
    v[i] = make_pair(a, b);
  }
  
  int ans = 1001;
  for(auto x : v) {
    int a, b;
    tie(a, b) = x;
    if(b <= t && a < ans) {
      ans = a;
    }
  }
  if(ans != 1001) cout << ans << endl;
  else cout << "TLE" << endl;
  return 0;
}

Measured memory_bytes: 3580
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	static int n;
	static int[] b;
	static long result = 0L;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		b = new int[n - 1];
		for (int i = 0; i < b.length; i++) {
			b[i] = sc.nextInt();
		}
		result += b[0];
		result += b[b.length - 1];
		for (int i = 0; i < b.length - 1; i++) {
			result += Math.min(b[i], b[i + 1]);
		}
		System.out.println(result);
	}
}


Measured memory_bytes: 23892
n,y=(int(i) for i in input().split())
#print(n,y)

flag=0
for a in range(n+1):
  if flag==0:
    for b in range(n+1):
      c=n-a-b
      if 10*a+5*b+c==y/1000 and c>=0 :
        flag=1
        print(str(a)+' '+str(b)+' '+str(c))

if flag==0:
  print(str(-1)+' '+str(-1)+' '+str(-1))

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

int main() {
    string S, T;
    cin >> S >> T;
    vector<int> s(26), t(26);
    for (int i = 0; i < S.size(); i++) {
        s[S[i] - 'a']++;
        t[T[i] - 'a']++;
    }
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    for (int i = 0; i < 26; i++) {
        if (s[i] != t[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 776
#ifdef LOCAL111
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#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) for (int i=(n)-1;i>=0;i--)
#define RBP(i,a) for(auto& i : a)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
#define rangej(a,b,c) ((a) <= (c) and (c) < (b))
#define rrangej(b,c) rangej(0,b,c)
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n;
	while(cin >> n){
		vector<int> t(n),a(n);
		REP(i,n){
			cin >> t[i] >> a[i];
		}
		LL tt = t[0], aa = a[0];
		FOR(i,1,n){
			LL ba = max((tt+t[i]-1)/t[i],(aa+a[i]-1)/a[i]);
			DEBUG(ba);
			tt = ba*t[i];
			aa = ba*a[i];
		}
		cout << tt+aa << endl;
	}
	return 0;
}


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

typedef long long int ll;
typedef pair<int, int> pii;
bool R(){return true;}
template<typename T, typename ... Args>
bool R(T & x, Args & ... args){return cin >> x && R(args...);}
void init_io(){ios::sync_with_stdio(false);cin.tie(0);}

#define PB push_back
#define FOR(prom, a, b) for(int prom = (a); prom < (b); prom++)
#define FORDE(prom, a, b) for(int prom = (a); prom >= (b); prom--)
#define ALL(vec) (vec).begin(), (vec).end()
#define MM(co, cim) memset((co), (cim), sizeof((co)))
#define DEB(x) cerr << ">>> " << #x << " : " << x << endl;
#define INF   1000000007
#define INFLL 4000000000000000007LL

char c;

void solve ()
{
  R(c);
  if (c <= 'Z') puts("A");
  else puts("a");
}

int main ()
{
  init_io();
  int T = 1;
  //R(T);
  while (T--) solve();
  return 0;
}


Measured memory_bytes: 3648
package main

import (
    "fmt"
    "os"
    "bufio"
    "sort"
    "math"
    "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {

    sc.Split(bufio.ScanWords)
    a, b := nextInt(), nextInt()

    GCD := gcd(a, b)

    fmt.Println(a*b/GCD)

}



//==================================================
//
// Library
//
//==================================================

//===========================
//  round(12.54, 0) -> 13.0
//  round(12.54, -1) -> 12.5
//===========================

func round(num float64, digit uint) float64 {
    d := float64(digit)
    return float64(int(num * math.Pow(10, d) + 0.5)) / math.Pow(10, d)
}

func abs(n int) int {
    return int(math.Abs(float64(n)))
}

func max(a, b int) int {
    return int(math.Max(float64(a), float64(b)));
}

func min(a, b int) int {
    return int(math.Min(float64(a), float64(b)));
}

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

    return gcd(y, x%y)
}

//===========================
//  var q Queue
//  q.Enqueue(n)
//  n := q.Dequeue()
//===========================
type Queue struct {
    data []int
}

func (q *Queue) Enqueue(n int) {
    q.data = append(q.data, n)
}

func (q *Queue) Dequeue() int {
    tmp := q.data[0]
    q.data = q.data[1:]
    return tmp
}

// 数値を桁区切りのスライスにする
func digit(n int, list []int) []int {
   if n > 0 {
       return digit(n/10, append(list, n%10))
   }
   return list
}

func sortIntsRev(list []int) {
    sort.Sort(sort.Reverse(sort.IntSlice(list)))
}

func strReverse(s string) string {
    runes := []rune(s)
    for i := 0; i < len(s)/2; i++ {
        runes[i], runes[len(s)-1-i] = runes[len(s)-1-i], runes[i]
    }
    return string(runes)
}

func nextInt() int {
    sc.Scan()
    i, _ := strconv.Atoi(sc.Text())
    return i
}

func nextStr() string {
    sc.Scan()
    return sc.Text()
}

func swap(a, b int) (int, int) {
    return b, a
}

func mySort(list []int, start int, end int) {
    var l []int
    for i := start; i < end; i++ {
        l = append(l, list[i])
    }
    sort.Ints(l)

    j := 0
    for i := start; i < end; i++ {
        list[i] = l[j]
        j++
    }
}

func mySortRev(list []int, start int, end int) {
    var l []int
    for i := start; i < end; i++ {
        l = append(l, list[i])
    }

    sortIntsRev(l)

    j := 0
    for i := start; i < end; i++ {
        list[i] = l[j]
        j++
    }
}

func nextPermutation(array []int) bool {
    n := len(array)

    for i:= n - 2; i >= 0; i-- {
        if array[i] < array[i+1] {
            j := n;
            for {
                j--;
                if (array[i] < array[j]) {
                    break
                }
            }
            array[i], array[j] = swap(array[i], array[j])
            mySort(array, i + 1, n)
            return true
        }
        if i == 0 {
            mySortRev(array, 0, n)
        }
    }
    return false
}



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

int main(){
  int x,y,p;
  cin >> x;
  p=x%10;
  x=(x-p)/10;
  y=p;
  p=x%10;
  x=(x-p)/10;
  y=y+p;
  p=x%10;
  y=y+p;
  cout << y << endl;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 100002
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 2000000000000000000LL
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

set <int> g[maxn] ;

int deg[maxn] , col[maxn] ;

int main()
{
    int i , j , k , l , m , n ;

    scanf("%d",&n) ;

    for(i=1 ; i<n ; i++)
    {
        int u , v ;
        scanf("%d %d",&u,&v) ;
        g[u].insert(v) ; g[v].insert(u) ;
    }

    for(i=0 ; i<n ; i++) deg[i] = (int)g[i].size() ;

    set < pair<int,int> > st ;

    for(i=0 ; i<n ; i++) st.insert(mp(deg[i],i)) ;

    int ans = 0 ;

    while( !st.empty() )
    {
        int u = (*(st.begin())).yy ;
     //   printf("u:%d deg[u]:%d\n",u,deg[u]) ;
        if( deg[u] >=2 ) break ;
        st.erase( st.begin() ) ;

        if(deg[u]==0)
        {
            printf("1\n") ;
            return 0 ;
        }

        int v = *(g[u].begin()) ;

        if( deg[v]<=2 )
        {
            st.erase( st.find( mp(deg[v],v) ) ) ;
            g[u].erase( g[u].find(v) ) ;
            g[v].erase( g[v].find(u) ) ;
            deg[v]-- ; deg[u]-- ;
            st.insert( mp(deg[v],v) ) ;
        }
        else
        {
            ans++ ;
            col[v] = 1 ;
        }
    }

    for(i=0 ; i<n ; i++) ans -= col[i] ;

    printf("%d\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 19712
/*
 * Author: Utkal Sinha
 * Created on: 2020-09-19, Sat, 17:48
 * Problem:
 * Platfrom: General
 * */
#if USE_BOOST2
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_bin_float.hpp>
namespace bst = boost::multiprecision;
typedef bst::int1024_t vll; //int512_t or //int128_t
typedef bst::cpp_bin_float_100 vdouble;
#endif

#include <bits/stdc++.h>
using namespace std;
#define GETTIME std::chrono::system_clock::now()
#define DURATION std::chrono::duration<double>
#ifdef MY_DEV_ENV2
#define LOCALDEV
#endif
typedef long long ll;
typedef std::chrono::system_clock::time_point TPT;
static TPT starttime, endtime, timelimit;
static double problem_tle = 1.5;
static inline void calc_problem_end_time() {timelimit = starttime + std::chrono::milliseconds(int (problem_tle * 1000));}
// template end

void love() {
    int n;
    cin >> n;
    ll ans = 0;
    if(n>1) {
        for(int i = 1; i<n; i++) {
            int nn = n-i;
            int lim = sqrt(1.0 * nn);
            for(int a = 1; a<=lim; a++) {
                if(nn % a == 0) {
                    int b = nn/a;
                    if(a == b) ans++;
                    else ans += 2;
                }
            }
        }
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    srand(time(0));
#ifdef LOCALDEV
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
#ifdef LOCALDEV
    starttime = GETTIME;
    calc_problem_end_time();
#endif
    while(t--) love();
#ifdef LOCALDEV
    endtime = GETTIME;
    DURATION elapsed_seconds = endtime - starttime;
    DURATION time_limit_seconds = timelimit - starttime;
    clog << "Elapsed time: " << elapsed_seconds.count() << "s\n";
    clog << "Time limit: " << time_limit_seconds.count() << "s\n";
#endif
    return 0;
}

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

int arr[2009];

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

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

	vector<int> v;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		v.push_back(arr[i]);
	}

	sort(v.begin(),v.end());
	int ans = INT_MAX;

	for(int i=0;i<n;i++){
		vector<int> val;
		vector<int> res;
		for(int j=0;j<n;j++){
			if(arr[j]>=v[i]){val.push_back(arr[j]);}
			else{
				sort(val.begin(),val.end());
				int len = (int)val.size();
				for(int a=0;a<len-k+1;a++){res.push_back(val[a]);}
				val.clear();
			}
		}
		sort(val.begin(),val.end());
		int len = (int)val.size();
		for(int a=0;a<len-k+1;a++){res.push_back(val[a]);}
		if((int)res.size() >= q){
			sort(res.begin(),res.end());
			ans = min(ans,(res[q-1]-v[i]));
		}
	}
	cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;

int main(void) {
    string ABCD;
    cin >> ABCD;

    vector<int> num;
    for(auto _num_char : ABCD) {
        num.push_back(_num_char - '0');
    }

    int num_length = num.size();

    for(int bit = 0; bit < (1 << num_length); bit++) {
        int ans = num[0];
        vector<bool> ope_arr(num_length - 1);

        for(int i = 0; i < num_length - 1; i++) {
            bool current_ope = bit & (1 << i);
            ope_arr[i] = current_ope;

            if(current_ope) {
                ans -= num[i + 1];
            } else {
                ans += num[i + 1];
            }
        }

        if(ans == 7) {
            for(int i = 0; i < num_length; i++) {
                cout << num[i];
                if(i == num_length - 1) {
                    cout << "=7" << endl;
                    return 0;
                } else if(ope_arr[i]) {
                    cout << "-";
                } else {
                    cout << "+";
                }
            }
        }
    }
}

Measured memory_bytes: 256
N, M = map(int, input().split())
S = [list(map(int, input().split()))[1::] for _ in range(M)]
P = list(map(int, input().split()))
ans = 0
for i in range(2 ** N):
    f = True
    bag = []
    jotai = [False for _ in range(M)]
    for j in range(0, N):  # このループが一番のポイント
        if (i >> j) & 1:  # 順に右にシフトさせ最下位bitのチェックを行う
            bag.append(j + 1)

    # for k, s in enumerate(S):
    #     total = 0
    #     for l in range(len(s)):
    #         for b in range(len(bag)):
    #             if l == b:
    #                 total += 1
    #     # print(total, k)
    #     if total % 2 == P[k]:
    #         jotai[k] = True
    #     if all(jotai):
    #         ans += 1

    for s in S:
        total = 0
        for ss in s:
            if ss in bag:
                total += 1
        if total % 2 != P[S.index(s)]:
            f = False
    if f:
        ans += 1
print(ans)



Measured memory_bytes: 44128
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define f first
#define s second
#define inf 1000000007


ll N;
vector<ll>A(100010);
vector<ll>B(100010);
vector<ll>C(100010);
vector<ll>R(100010);
vector<ll>R1(100010);
int main() {
    cin >> N;
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N) cin >> C[i];
    sort(A.begin(),A.begin()+N);
    sort(B.begin(),B.begin()+N);
    sort(C.begin(),C.begin()+N);
    
    rep(i,N){
        ll temp = upper_bound(C.begin(),C.begin()+N,B[i]) - C.begin();
        R[i] = N-temp;
    }
    // rep(i,N) cout << R[i] << " ";
    // cout << endl;
    for(ll i=N-1;i>=0;i--){
        R1[i] = R1[i+1]+R[i];
    }
    // rep(i,N+1) cout << R1[i] << " ";
    // cout << endl;
    ll ans = 0;
    rep(i,N){
        ll temp = upper_bound(B.begin(),B.begin()+N,A[i]) - B.begin();
        // cout << temp << endl;
        ans += R1[temp];
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4224
import std.stdio;
import std.math;
import std.algorithm;

double[100] bx, by, br;
int n, m;
double tx, ty, sx, sy;

void main(){
	while (readf("%d\n", &n), n) {
		foreach (i; 0..n) {
			readf("%s %s %s\n", &bx[i], &by[i], &br[i]);
		}

		readf("%d\n", &m);
		foreach (i; 0..m) {
			readf("%s %s %s %s\n", &tx, &ty, &sx, &sy);
			if (isSafe()) writeln("Safe");
			else writeln("Danger");
		}
	}
}

bool isSafe(){
	double relation;
	for (int i = 0; i < n; i++) {
		relation = inCircle(i, tx, ty) + inCircle(i, sx, sy);
		if (relation == 0) return true;
		if (br[i] >= perpendicular(i) && acuteAngle(i) && relation != 2) return true;
	}
	return false;
}

// in: 1, out: -1
int inCircle(int id, double x, double y){
	double dx = x - bx[id];
	double dy = y - by[id];
	if (br[id] > sqrt(dx*dx + dy*dy)) return 1;
	return -1;
}

// distance from line to point
double perpendicular(int id){
	double a, b, c;
	a = sy - ty;
	b = tx - sx;
	c = ty*sx - tx*sy;
	return abs(a*bx[id] + b*by[id] + c) / sqrt(a*a + b*b);
}

// inner product > 0 ?
bool acuteAngle(int id){
	double x1, x2, y1, y2;
	x1 = sx - tx;
	y1 = sy - ty;
	x2 = bx[id] - tx;
	y2 = by[id] - ty;
	if (x1*x2 + y1*y2 < 0) return false;
	x1 = -x1;
	y1 = -y1;
	x2 = bx[id] - sx;
	y2 = by[id] - sy;
	if (x1*x2 + y1*y2 < 0) return false;
	return true;
}

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

int main()
{
    string A, B;
    cin >> A >> B;
    if (A.size() > B.size())
    {
        cout << "GREATER";
    }
    else if (A.size() < B.size())
    {
        cout << "LESS";
    }
    else
    {

        if (A > B)
        {
            cout << "GREATER";
        }
        else if (A < B)
        {
            cout << "LESS";
        }
        else
        {
            cout << "EQUAL";
        }
    }
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    int a, b, c;
    cin >> a >> b >> c;

    // 処理
    // 出力
    if (a == b) {
        cout << c << endl;
    } else if (b == c) {
        cout << a << endl;
    } else {
        cout << b << endl;
    }

    return 0;
}


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

int main() {
    int n;
    cin>>n;
    vector<long long> a(n);
    rep(i,n) cin>>a.at(i);
    map<long,long> mi,pu;
    rep(i,n){
        mi[1+i-a.at(i)]++;
        pu[1+i+a.at(i)]++;
    }
    long long ans=0;
    rep(i,n) ans+=mi[i]*pu[i];
    cout<<ans;
    
}

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

int main(){
    int N=0,count=0;
    cin >> N;
    for(int i=1;i<=N;i++){
        if(i>=0&&i<=9)count++;
        if(i>=100&&i<=999)count++;
        if(i>=10000&&i<=99999)count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
program sample
    implicit none
    
    integer(8) :: i,j,l,m,n,a,b,c,d,c1,d1,d2
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) a,b,c,d
    m=b/c-(a-1)/c
    n=b/d-(a-1)/d
    c1=max(c,d)
    d1=min(c,d)
    do i=1,10**6
        d2=mod(c1,d1)
        c1=d1
        d1=d2
        if(d1==0)then
            exit
        end if
    end do
    d1=c*d/c1
    l=b/d1-(a-1)/d1
    write(*,*)b-(a-1)-m-n+l


        
    stop
end program sample
  



Measured memory_bytes: 2816
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <deque>
#include <valarray>
#include <unordered_map>
#include <unordered_set>
#include <array>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef vector<vc> vvc;
typedef vector<vb> vvb;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
#define pb push_back
#define mp make_pair
#define PF first
#define PS second
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 A, size_t N, typename T>void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
#define OUT(x) cout << x << endl;
#define OUTD(x) cout << fixed << x << endl;
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll MOD = 1000000007;
const ll INF = 10e9;
#define PI 3.14159265369;
ll dx[4] = {1,-1,0,0};
ll dy[4] = {0,0,1,-1};
ll ddx[8] = {1,1,1,-1,-1,-1,0,0};
ll ddy[8] = {0,1,-1,0,1,-1,1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  IN(ll,N);
  AIN(str,S,N);
  ll ans = 0;
  map<str,ll> mp;
  REP(i,N){
    SORT(S.at(i));
    ans += mp[S.at(i)];
    mp[S.at(i)]++;
  }
  OUT(ans);
}

Measured memory_bytes: 16640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 
LL MOD=1000000007;

int main()
{ 
    int n;
    cin>>n;
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    sort(s,s+n);
    vector<string> mem;
    int max=1;
    int cnt=1;
    for(int i=1;i<n;i++){
        if(s[i]==s[i-1]){cnt++;}
        else{
            if(max<cnt){
                max=cnt;
                mem.resize(0);
                mem.push_back(s[i-1]);
            }
            else if(max==cnt){
                mem.push_back(s[i-1]);
            }
            cnt=1;
        }
    }
    if(max<cnt){
        max=cnt;
        mem.resize(0);
        mem.push_back(s[n-1]);
    }
    else if(max==cnt){
        mem.push_back(s[n-1]);
    }
    sort(mem.begin(),mem.end());
    reverse(mem.begin(),mem.end());
    int m=mem.size();
    for(int i=0;i<m;i++){
        cout<<mem.back()<<endl;
        mem.pop_back();
    }
    return 0;
}

Measured memory_bytes: 15988
#include<iostream>
#include<string.h>
using namespace std;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int long long a,b;
    cin >> a >> b;
    int long long i,ans;
    for(i = 1; i < a*b + 1; i++){
        if((min(a,b) * i) % max(a,b) == 0){
            ans = min(a,b) * i;
            break;
        }

    } 
    cout << ans;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    N=int(input())
    Values =  [int(s) for s in input().split()]
    Costs =  [int(s) for s in input().split()]
    result = 0
    for i in range(N):
        value = Values[i]
        cost = Costs[i]
        if value > cost:
            result += (value - cost)
    print(result)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let a: f64 = s.trim().parse().unwrap();
    let d = a / 3.0;
    let ans = d * d * d;
    println!("{:.7}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MOD = 1e9 + 7;
const int INF = 2e9;
#define pb push_back
#define mp make_pair
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 (a>b) { a=b; return 1; } return 0; }

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int ans;
    if(a*n < b){
        ans = a*n;
    }
    else{
        ans = b;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int solve(long long int w[], long long int v[], int n, int wt)
{
    long long int dp[n + 1][wt + 1];
    for(int i = 0; i < n + 1; i++) {
        for(int j = 0; j < wt + 1; j++) {
            if(i == 0 || j == 0)
                dp[i][j] = 0;
        }
    }
    for (int i = 1; i < n + 1; i++) {
        for (int j = 1; j < wt + 1; j++) {
            if (w[i - 1] <= j) 
                dp[i][j] = max(v[i - 1] + dp[i - 1][j - w[i - 1]], dp[i - 1][j]);
            else 
                dp[i][j] = dp[i - 1][j];
        }
    }
    return dp[n][wt];
}
int main() {
    int n,wt;
    cin >> n >> wt;
    long long int w[n], v[n];
    for(int i = 0; i < n;i++) {
        cin >> w[i] >> v[i];
    }
    cout << solve(w,v,n,wt);
}

Measured memory_bytes: 82492
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) b.rbegin(),v.rend()
typedef long long ll;
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);

  int n;
  cin >> n;
  vector<int> h(n);
  rep(i,n){
    cin >> h.at(i);
  }
  for(int i=n-1; i>0; i--){
    if(h.at(i-1)<=h.at(i)){

    }else{
      h.at(i-1)--;
      if(h.at(i-1)<=h.at(i)){

      }else{
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << max( { a + b, a - b, a * b } ) << endl;
}

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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

class Edge
{
    public:
    ll A,B;
    bool necessity = true;
};

class Node
{
    public:
    ll number;
    bool getable = false;
    ll seen_times = 0;
    vector<ll> next;
    bool seen = false;
};

void Sort_Edge(vector<Edge>& Graph_Edge)
{
    sort(ALL(Graph_Edge),
    [](Edge& A, Edge& B)
    {
        return (A.A == B.A) ? (A.B < B.B) : (A.A < B.A);
    });
}

void ALLIN_GRAPH(ll N, ll M, vector<Node>& Graph_Node, vector<Edge>& Graph_Edge)
{
    for(ll i=0;i<N;i++)
    {
        Graph_Node[i].number = i;
    }
    for(ll i=0;i<M;i++)
    {
        ll a,b;
        cin >> a >> b;

        Graph_Node[a-1].next.push_back(b-1);
        Graph_Node[b-1].next.push_back(a-1);

        Edge add;
        add.A = a-1; add.B = b-1;
        Graph_Edge.push_back(add);
    }
    Sort_Edge(Graph_Edge);
}

void Limited_BFS(vector<Node> Graph_Node, Edge& One_Graph_Edge)
{
    queue<Node> bfs;
    bfs.push(Graph_Node[0]);

    while(!bfs.empty())
    {
        for(auto x : bfs.front().next)
        {
            if(!Graph_Node[x].seen && 
            !((bfs.front().number==One_Graph_Edge.A && Graph_Node[x].number==One_Graph_Edge.B) || (bfs.front().number==One_Graph_Edge.B && Graph_Node[x].number==One_Graph_Edge.A)))
            {
                bfs.push(Graph_Node[x]);
                Graph_Node[x].seen = true;
                Graph_Node[x].getable = true;
            }
        }
        bfs.pop();
    }

    Graph_Node[0].getable = true;

    for(auto x : Graph_Node)
    {
        if(!x.getable)
        {
            One_Graph_Edge.necessity = true;
            return;
        }
    }
    One_Graph_Edge.necessity = false;
    return;
}

void Ans(vector<Node> Graph_Node, vector<Edge>& Graph_Edge)
{
    for(auto& x : Graph_Edge)
    {
        Limited_BFS(Graph_Node,x);
    }
}


void Ans_OUT(vector<Edge> Graph_Edge)
{
    ll counter = 0;
    for(auto x : Graph_Edge)
    {
        if(x.necessity) counter++;
    }
    cout << counter << endl;
}

int main()
{
    ll N,M;
    cin >> N >> M;

    vector<Node> Graph_Node(N);
    vector<Edge> Graph_Edge;
    ALLIN_GRAPH(N,M,Graph_Node,Graph_Edge);

    Ans(Graph_Node,Graph_Edge);
    Ans_OUT(Graph_Edge);

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node{
  struct node *prev;
  struct node *next;
  long key;
};
typedef struct node * NP;
NP MN(long);
void IN(NP);
void DN(NP);
void FI(long);
NP dummy;

int main(){
  long int val,i,n;
  char op[12];
  NP roop;

  scanf("%ld",&n);
  dummy=MN(0);
  for(i=0;i<n;i++){
    scanf("%s",op);
    
    if(strcmp(op,"insert") == 0){
      scanf("%ld",&val);
      IN(MN(val));
    }
    else if(strcmp(op,"delete") == 0){
      scanf("%ld",&val);
      FI(val);
    }
    else if(strcmp(op,"deleteFirst") == 0){
      if(dummy->next != dummy){
	DN(dummy->next);
      }
    }
    else if(strcmp(op,"deleteLast") == 0){
      if(dummy->prev != dummy){
	DN(dummy->prev);
      }
    }
    
  } 
  
  for(roop=dummy->next;roop!=dummy;roop =roop->next){
    printf("%ld",roop->key);
    if(roop->next != dummy)printf(" ");
  }
  printf("\n");
  
  return 0;
}
 


void FI(long value){ // find item                                               
  NP n;
  dummy->key = value;
  for(n = dummy->next;;n=n->next){
    if(n->key == value)break;
  }
  if(n != dummy)DN(n);

}
void DN(NP th){ //delete node                                                   
  th->prev->next = th->next;
  th->next->prev = th->prev;
  th->prev = th->next = th;
  free(th);
  //delete th;                                                                  
}
void IN(NP newn){ //insert node                                                 
  newn->next = dummy->next;
  newn->next->prev = newn;
  dummy->next = newn;
  newn->prev = dummy;
}

NP MN(long key){ //make node                                                    
  NP no = (NP)malloc(sizeof(struct node));
  //n = new struct node();                                                      
  no->prev = no;
  no->next = no;
  no->key = key;
  return no;
}

Measured memory_bytes: 0
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int main() {
	ll n, X, m;
	cin >> n >> X;
	vector<ll> x((unsigned int)n);
	rep(i, 0, n)cin >> x[i], x[i] = abs(x[i] - X);
	m = x[0];
	rep(i, 1, n) {
		m = gcd(m, x[i]);
	}
	printf("%lld\n", m);
	return 0;
}


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

int main(void) 
{
    string s, t;
    cin >> s >> t;
    int num = 0;

    rep(i,s.size()-t.size()+1)
    {
        int snum = 0;
        rep(j,t.size())
        {
            if(s[i+j] == t[j]) snum++;
        }
        num = max(num, snum);
    }

    cout << t.size() - num << endl;
}

Measured memory_bytes: 3600
import java.util.Scanner;

class Main
{
	public static void main(String[] args){
	
	Scanner scan = new Scanner(System.in);
	
	int[] a = new int[1000];
	int x = 0;
	int z = 1;
		
	int n = scan.nextInt();
		
	a[0] = n;
	
	int na = n;
	
	for(int i=2; i<=n/2; i++){
		if((n / z) % i == 0){
			a[x] = i;
			x++;
			z *= i;
			i = 1;
		}
	}
		if(x==0){
			x = 1;}
	
		System.out.print(na+":");
	
		for(int i=0; i<x; i++){
			System.out.print(" "+a[i]);
		}
	
		System.out.print("\n");
	}
}


Measured memory_bytes: 26540
from fractions import gcd

"""

+ その範囲の6の倍数の数
  これはBまでの倍数の数からAまでの倍数の数を引く
+ その範囲の8の倍数の数
- その範囲の48の倍数の数
で答えが求まる

"""

def v_count(n, start, end):
  a = (start - 1) // n
  b = end // n
  return b - a

A, B, C, D = list(map(lambda x: int(x), input().split()))

all_count = B - A + 1

c_count = v_count(C, A, B)
d_count = v_count(D, A, B)
min_cd = (C * D) // gcd(C, D)
cd_count = v_count(min_cd, A, B)

print(all_count - c_count - d_count + cd_count)


Measured memory_bytes: 5368
#include<bits/stdc++.h>
using namespace std;
int l,n,a[100100],ans=0;
int main(){
	cin>>l>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		ans+=a[i];
	}
	if(ans>=l) cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 640
N, K = map(int, input().split())
V = list(map(int, input().split()))

def solve(N,K,V):
    ans = 0
    V = V*2
    for l in range(N+1):
        for r in range(N-1,2*N):
            n = r-l+1
            if n == 0 or n>K or n>N:
                continue
            p = K-n
            W = V[l:r+1]
            W.sort()
            total = sum(W)
            firstp = W[:p]
            for w in firstp:
                if w<0:
                    total -= w
                else:
                    break
            ans = max(ans,total)
    return ans
print(solve(N,K,V))

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#define _GLIBCXX_DEBUG
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int A,B;
    cin >> A >> B ;
    string S;
    cin >> S;
    int total = A + B + 1;
    for(int i=0;i<total;i++){
        if(i==A){
            if(S[i]!='-'){
                cout << "No" << endl;
                break;
            }
        }
        else if((S[i] < '0')||(S[i] > '9') ){
            cout << "No" << endl;
            break;
        }
        else if(i== total - 1){
            cout << "Yes" << endl;
        }
    }
}

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

const int NMAX = 110;

int main()
{
  int N;
  while(cin >> N){
    int col[N];
    int A,B,C;
    cin >> A >> B >> C;
    for(int i = 0; i < N; ++i){
      cin >> col[i];
    }

    sort(col,col+N);
    reverse(col,col+N);
    

    int col_total[N+1];
    int dol_total[N+1];

    for(int i = 0; i <= N; ++i){
      col_total[i] = dol_total[i] = 0;
    }
    col_total[0] = C;
    dol_total[0] = A;
    for(int i = 0; i < N; ++i){
      col_total[i+1] += col_total[i] + col[i];
      dol_total[i+1] += dol_total[i] + B;
    }

    int maxi = 0;
    for(int i = 0; i <= N; ++i){
      //cout << col_total[i] << ' ' << dol_total[i] << endl;
      maxi = max( maxi, col_total[i] / dol_total[i] );
    }

    cout << maxi << endl;

  }
  return 0;
}

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

int main()
{
	string s;
	cin >> s;
	string ans;
	for(auto c : s){
		switch(c){
			case 'B':
				if(!ans.empty()) ans.erase(--ans.end());
				break;
			default:
				ans += c;
				break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main (void) {

  string c1, c2;

  cin >> c1 >> c2;

  if (c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0])
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
  
}

Measured memory_bytes: 256