akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int n,m;
    cin>>n>>m;
    int a[n];
    int sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    int cal;
    if(sum%(4*m)==0){
        cal = sum/(4*m);
    }else{
        cal = (sum+4*m)/(4*m);
    }
    int co = 0;
    rep(i,n){
        if(a[i]>=cal){
            co++;
        }
    }
    if(co>=m){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int A[2000000],B[2000000],C[10001];
void Sort(int n)
{
    int i;
    for(i=0;i<10001;i++)
        C[i] = 0;
    for(i=0;i<n;i++)
        C[A[i]]++;
    for(i=0;i<10000;i++)
        C[i+1] += C[i];
    for(i=0;i<n;i++)
    {
        B[C[A[i]]-1] = A[i];
        C[A[i]]--;
    }
}
int main()
{
    int n,i;
    cin>>n;
    for(i=0;i<n;i++)
        cin>>A[i];
    Sort(n);
    for(i=0;i<n;i++)
    {
        if(i)
            cout<<' ';
        cout<<B[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 18700
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**7) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())



a = str(input())
ans=''
for c in a:
    if c=='1':
        ans = ans + '9'
    elif c=='9':
        ans = ans + '1'
    else:
        ans = ans + c

print(ans)


Measured memory_bytes: 3064
def inpl(): return [int(i) for i in input().split()]

N, M = inpl()
path = [True for _ in range(N+1)]

for _ in range(M):
    a, b = inpl()
    path[a] = not path[a]
    path[b] = not path[b]

if all(path):
    print('YES')
else:
    print('NO')

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

int main(){
  
  string s,t;
  cin >> s >> t;
  
  if(s.at(0)==t.at(0)&&s.at(1)==t.at(1)&&s.at(2)==t.at(2)){
    cout << 3 << endl;
  }else if(s.at(0)==t.at(0)&&s.at(1)==t.at(1)){
    cout << 2 << endl;
  }else if(s.at(0)==t.at(0)&&s.at(2)==t.at(2)){
    cout << 2 << endl;
  }else if(s.at(1)==t.at(1)&&s.at(2)==t.at(2)){
    cout << 2 << endl;
  }else if(s.at(0)!=t.at(0)&&s.at(1)!=t.at(1)&&s.at(2)!=t.at(2)){
    cout << 0 << endl;
  }else{
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

MOD = int(1e09) + 7

def main():
    L,R = cin.mapInt()
    if L // 2019 != R // 2019:
        print(0)
        return
    L %=2019
    R %=2019
    ans = int(1e09)
    for i in range(L,R + 1):
        for j in range(i + 1,R + 1):
            ans = min(ans,(i * j) % 2019)
    print(ans)
    return

if __name__ == "__main__":
    main()


Measured memory_bytes: 39152
taro = hanako = 0                    
for _ in range(int(input())):        
  t, h = input().split()             
  if t == h:                         
    taro += 1                        
    hanako += 1                      
  elif t > h:                        
    taro += 3                        
  else:                              
    hanako += 3                      
print("{} {}".format(taro, hanako))  

Measured memory_bytes: 7636
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
typedef long long ll;

int n,m,q;
int ans=0;
vector<int> a,b,c,d;

int dfs(vector<int> p){
    if(p.size() == n+1){
        int tmp_ans=0;
        rep(i,q){
            if(p[b[i]]-p[a[i]]==c[i]) tmp_ans+=d[i];
        }
        if(ans < tmp_ans) ans = tmp_ans;
        return 0;
    }
    p.push_back(p.back());
    while(p.back() < m+1){
        dfs(p);
        p.back()++;
    }
    return 0;
}

int main(){
    cin>>n>>m>>q;
    int x,y,z,w;
    vector<int> p(1,1);
    rep(i, q){
        cin>>x>>y>>z>>w;
        a.push_back(x);
        b.push_back(y);
        c.push_back(z);
        d.push_back(w);
    }
    dfs(p);
    cout << ans << endl;
}

Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	ll n, m, x[100000], y[100000];
	cin >> n >> m;
	for(int i=0; i<m; i++){
		cin >> x[i];
	}
	sort(x, x+m);
	ll ans=0;
	for(int i=1; i<m; i++){
		y[i-1]=x[i]-x[i-1];
	}
	sort(y, y+m-1);
	for(int i=0; i<m-n; i++){
		ans+=y[i];
	}
	cout << ans << endl;

	return 0;
}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<ll, ll> P;

const int N = 3e5+5;
string s;
vector<int> v[N];
int n, k;
ll a[N],m[N], l[N];
ll result;
priority_queue<ll, vector<ll>, less<ll> > q;
priority_queue<ll, vector<ll>, greater<ll> > que;

int main () {
  cin >> n;
  n*= 3;
  rep(i,n) {
    cin >> a[i];
    if(i < n/3) {
      que.push(a[i]);
      m[0] += a[i];
    } else if(i>=n/3*2) {
      q.push(a[i]);
      l[n/3] += a[i];
    }
  }
  rep(i,n/3) {
    que.push(a[i+n/3]);
    m[i+1] = m[i] + a[i+n/3] - que.top();
    que.pop();
  }
  rep(i,n/3) {
    q.push(a[n/3*2 - i - 1]);
    l[n/3 - i - 1] = l[n/3 - i] + a[n/3*2 - i -1] - q.top();
    q.pop();
  }
  result = m[0] - l[0];
  rep(i,n/3 ) result = max(result, m[i+1] - l[i+1]);
  cout << result << endl;
}


Measured memory_bytes: 14708
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var N, K, ans int
	fmt.Scan(&N, &K)
	p := N % K
	q := -(p - K)
	if p < q {
		ans = p
	} else {
		ans = q
	}
	fmt.Fprintln(wtr, ans)
	_ = wtr.Flush()
}


Measured memory_bytes: 1824
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define all(v)			((v).begin()), ((v).end())
#define SZ(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define has(c,i) 		((c).find(i) != end(c))
#define has_str(s, c)	((s).find(c) != string::npos)
typedef long long ll;
int main() {
#ifdef online_judge
    freopen("input.txt", "rt", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int red = count(all(s), 'R');
    int cnt = 0, ans = red;
    for(int i = 0; i < n; ++i) {
        if(s[i] == 'R') {
            red--;
            cnt++;
        }
        int x = i + 1 - cnt;
        ans = min(ans, x + max(0, red - x));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3720
# https://atcoder.jp/contests/abc110/tasks/abc110_c

S = input()
T = input()


def to_dict(s):
    dic = {}
    for c in list(s):
        if c in dic:
            dic[c] += 1
        else:
            dic[c] = 1

    return sorted(list(dic.values()))


sl = to_dict(S)
tl = to_dict(T)

if to_dict(S) == to_dict(T):
    print("Yes")
else:
    print("No")



Measured memory_bytes: 5168
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
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;
}

ll M = 1000000007;

void solve()
{
	ll x;
	cin>>x;
	ll sta=100;
	int year=0;
	rep(i,10000){
		sta*=1.01;
		if(sta>=x){
			year=i+1;
			break;
		}
	}
	cout<<year<<endl;
}

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


Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long int map[100][100];
long int map2[100][100];
long int map3[100][100];
int main(void) {
	int n, m, l;
	cin >> n >> m >> l;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> map[i][j];
		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> map2[i][j];
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			for (int k = 0; k < m; k++) {
				map3[i][j] += map[i][k] * map2[k][j];
			}
			if (j)cout << " ";
			cout << map3[i][j];
		}
		cout << endl;
	}
}


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

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

  if(0 < a && a < 10){
    if(0 < b && b < 10){
      std::cout << (a*b) << std::endl;
      return 0;
    }
  }

  std::cout << "-1" << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

void func(int N,int R){
	queue<int> A,B,C;

	for(int i = 0; i < N;i++)C.push(i);

	int tmp,count = 0;
	for(int loop = 0; loop < R; loop++){

		for(int i = 0; i < N/2; i++){
			B.push(C.front());
			C.pop();
		}
		for(int i = N/2; i < N; i++){
			A.push(C.front());
			C.pop();
		}

		scanf("%d",&tmp);

		while(A.empty() == false || B.empty() == false){
			count = 0;
			while(A.empty() == false && count < tmp){
				C.push(A.front());
				A.pop();
				count++;
			}

			count = 0;
			while(B.empty() == false && count < tmp){
				C.push(B.front());
				B.pop();
				count++;
			}
		}
	}

	printf("%d\n",C.back());
}


int main(){

    int N,R;
    while(scanf("%d %d",&N,&R)!=EOF){
    	func(N,R);
    }

    return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;

void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int n;
int l[2002];
ll res;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    cin >> n;
    FOR(i, 1, n) cin >> l[i];
    sort(l + 1, l + 1 + n);
    FORd(i, n, 1)
        FORd(j, i - 1, 1)
        {
            int x = l[i] - l[j] + 1;
            if(x > l[j]) continue;
            int pos = lower_bound(l + 1, l + j + 1, x) - l;
            if(pos == j) continue;
            res = res + j - pos;
            //cout << res << " " << i << " " << j << endl;
           // sp;
        }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


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

  vector<bool> flag(5000, false);
  flag[0] = true;
  for(int i = 0; i+C < 5000; i++){
    if(flag[i]) flag[i+C] = true;
  }
  for(int i = 0; i+D < 5000; i++){
    if(flag[i]) flag[i+D] = true;
  }

  vector<int> sugar;
  REP(i, 5000) if(flag[i]) sugar.emplace_back(i);


  pair<int, int> ans = {-1, -1};
  REP(i, 40) REP(j, 40){
    int water = i*A*100+j*B*100;
    int m = min(F-water, E*water/100);
    if(water > F) continue;

    int it = upper_bound(ALL(sugar), m)-sugar.begin()-1;

    if(ans.second*(water+sugar[it]) < sugar[it]*(ans.first+ans.second)){
      ans = {water, sugar[it]};
    }
  }

  cout << ans.first+ans.second << " " << ans.second << endl;

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(), (x).end()
#define Sort(x) sort((x).begin(), (x).end())
#define Reverse(x) reverse((x).begin(), (x).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for (int i = m; i < n; i++)
#define INF INT_MAX
#define fcout cout << fixed << setprecision(15) // 15桁まで表示
#define en '\n'
using str = string;
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using puu = pair<ui, ui>;
using P = pair<int, int>;
using vi = vector<int>;
int gcd(int a, int b) {
  return b ? gcd(b, a % b) : a;
};
int lcm(int a, int b) {
  return a / gcd(a, b) * b;
};
int floor(int a, int b) {
  return (a + b - 1) / b;
};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
};
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
};
const ll mod = 1000000007;
const double PI = acos(-1.0);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << setiosflags(ios::fixed);
  int n;
  cin >> n;
  cout << 48-n << en;

}

Measured memory_bytes: 3524
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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(){
	string s;
while(getline(cin,s)&&s!="."){
	string t={};
	for(char c:s)if(c=='('||c==')'||c=='['||c==']')t+=c;
	stack<char> st;
	bool ok=true;
	for(auto c:t){
		if(c=='('||c=='[')st.push(c);
		else{
			if(st.empty())ok=false;
			else{
				if(c==')'&&st.top()!='(')ok=false;
				if(c==']'&&st.top()!='[')ok=false;
				st.pop();
			}
		}
	}
	ok&=st.empty();
	cout<<(ok?"yes":"no")<<endl;
}
}



Measured memory_bytes: 3224
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n; cin >> n;
	vector<int>d(n);
	for (auto& e : d)cin >> e;

	int sum = 0;
	for (int i = 0; i < n - 1; ++i)
		for (int j = i + 1; j < n; ++j)
			sum += d[i] * d[j];

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int inverse(int x){
    return binpow(x, MOD - 2, MOD);
}
int ncr(int n, int k) 
{ 
    int ne = 1, de = 1; 
    if (k > n - k) k = n - k;
    for (int i = 0; i < k; ++i) { 
        de = (de * (i + 1)) % MOD;
        ne = (ne * (n - i)) % MOD;
    }
    return ne * inverse(de) % MOD;
} 
void solve()
{
    int N, A, B;
    cin >> N >> A >> B;
    int ans = binpow(2, N, MOD) - 1 - ncr(N, A) - ncr(N, B);
    cout << (ans % MOD + MOD) % MOD << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

Measured memory_bytes: 3696
fun main(args: Array<String>) {
  val (wCount, bCount) = readLine()!!.split(" ").map(String::toInt)
  var wRemaining = wCount - 1
  var bRemaining = bCount - 1
  
  println("98 99")
  
  for (y in 0 until 49) {
    if (y % 2 == 0) {
      println(String(CharArray(99, { '#' })))
    } else {
      val chars = CharArray(99, { '#' })
      for (x in 0 until 99) {
        if (x % 2 == 1) {
          if (wRemaining > 0) {
            chars[x] = '.'
            wRemaining--
          }
        }
      }
      println(String(chars))
    }
  }

  for (y in 0 until 49) {
    if (y % 2 == 0) {
      println(String(CharArray(99, { '.' })))
    } else {
      val chars = CharArray(99, { '.' })
      for (x in 0 until 99) {
        if (x % 2 == 1) {
          if (bRemaining > 0) {
            chars[x] = '#'
            bRemaining--
          }
        }
      }
      println(String(chars))
    }
  }
}

Measured memory_bytes: 37892
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int MOD = 998244353;
vector<int> powers;

int n;
struct Graph {
	vector<vector<int>> edges;
	vector<int> nimber;
	vector<int> groups;
	void read() {
		edges.resize(n + 1);
		nimber.resize(n + 1);
		int m;
		cin >> m;
		for(int i = 0; i < m; ++i) {
			int a, b;
			cin >> a >> b;
			edges[a].push_back(b);
			edges[b].push_back(a);
		}
		for(int a = n; a >= 1; --a) {
			set<int> nei;
			for(int b : edges[a]) {
				if(b > a) {
					nei.insert(nimber[b]);
				}
			}
			for(int value = 0; true; ++value) {
				if(!nei.count(value)) {
					nimber[a] = value;
					break;
				}
			}
			int i = nimber[a];
			while((int) groups.size() <= i) {
				groups.push_back(0);
			}
			groups[i] += powers[a];
			groups[i] %= MOD;
		}
	}
};

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	powers.resize(n + 1);
	powers[0] = 1;
	for(int i = 1; i <= n; ++i) {
		powers[i] = (long long) 1'000'000'000'000'000'000 % MOD * powers[i-1] % MOD;
	}
	
	Graph graphs[3];
	for(int i : {0, 1, 2}) {
		graphs[i].read();
	}
	int hope = 0;
	for(int a = 0; a < (int) graphs[0].groups.size(); ++a) {
		for(int b = 0; b < (int) graphs[1].groups.size(); ++b) {
			int c = a ^ b;
			if(c < (int) graphs[2].groups.size()) {
			// for(int c = 0; c < (int) graphs[2].groups.size(); ++c) {
				if((a ^ b ^ c) == 0) {
					hope += (long long) graphs[0].groups[a] * graphs[1].groups[b] % MOD * graphs[2].groups[c] % MOD;
					hope %= MOD;
				}
			}
		}
	}
	printf("%d\n", hope);
}


Measured memory_bytes: 17280
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main() {
    ll n;
    cin >> n;
    int count = 0;
    int name[50];
    while(n) {
        name[count] = n % 26;
        n /= 26;
        if (name[count] == 0) {
            name[count] = 26;
            n--;
        }
        count++;
    }
    char s[count];
    for (int i = count - 1; i >= 0; i--) {
        s[i] = 96 + name[i];
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3512
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	int i,k,len,j,data[7],wk,x,y,q,da[7],l;
	for(i=1;i<=6;i++)	scanf("%d",&da[i]);
	scanf("%d",&q);
	for(i=0;i<q;i++)	{
		scanf("%d %d",&x,&y);
		for(j=1;j<=6;j++)	data[j]=da[j];
		for(j=0;j<4;j++)	{
			wk=data[1];
			data[1]=data[2];
			data[2]=data[6];
			data[6]=data[5];
			data[5]=wk;
			for(k=0;k<4;k++)	{
				wk=data[1];
				data[1]=data[4];
				data[4]=data[6];
				data[6]=data[3];
				data[3]=wk;
				for(l=0;l<4;l++)	{
					wk=data[2];
					data[2]=data[3];
					data[3]=data[5];
					data[5]=data[4];
					data[4]=wk;
					if(data[1]==x && data[2]==y)	{
						printf("%d\n",data[3]);
						j=4;	k=4;	l=4;
					}
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
long long n,m,k,ans=0,cnt=0,tmp;
string s;
int main(){
  cin >> n >> m >> k;
  cout << min({n,m,k})+max({n,m,k})*10+n+m+k-min({n,m,k})-max({n,m,k}) << endl;
  return 0;
}


Measured memory_bytes: 764
N = int(input())
A = list(map(int,input().split()))
mx = max(A)
mxi = A.index(mx)
mn = min(A)
mni = A.index(mn)

ans = []
if mn >= 0 or mx + mn >= 0:
    for i in range(N):
        if A[i] < 0:
            ans.append((mxi, i))
    for i in range(N-1):
        ans.append((i, i+1))
else:
    for i in range(N):
        if A[i] > 0:
            ans.append((mni, i))
    for i in range(N-1,0,-1):
        ans.append((i, i-1))

print(len(ans))
for a,b in ans:
    print(a+1, b+1)

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

using ll = long long;

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

    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    // 第一要素を+にする
    ll ans = (1LL << 60),
       cnt = 0,
       cumsum = 0;
    for (int i = 0; i < n; i++) {
        if ((i % 2 == 0 && a[i] + cumsum <= 0) ||
            (i % 2 == 1 && a[i] + cumsum >= 0)) {
            cnt += abs(a[i] + cumsum) + 1;
            cumsum += (i % 2 == 0 ? 1 : (-1)) * (abs(a[i] + cumsum) + 1);
        }
        cumsum += a[i];
        // cerr << "i: " << i << ", cumsum: " << cumsum << ", cnt: " << cnt << endl;
    }

    ans = cnt;

    cnt = 0;
    cumsum = 0;
    for (int i = 0; i < n; i++) {
        if ((i % 2 == 0 && a[i] + cumsum >= 0) ||
            (i % 2 == 1 && a[i] + cumsum <= 0)) {
            cnt += abs(a[i] + cumsum) + 1;
            cumsum += (i % 2 == 1 ? 1 : (-1)) * (abs(a[i] + cumsum) + 1);
        }
        cumsum += a[i];
    }

    ans = min(ans, cnt);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
s = a.inject(:+)
if s == 0 || s == n
  p 0
else
  p b.group_by.with_index {|_, i| a[i]}.values.map(&:min).inject(:+)
end


Measured memory_bytes: 6864
#11
import sys
A,B,C = map(int,input().split())

a1,b1,c1,cou= 0,0,0,0



while A%2 == 0 and B%2 == 0 and C%2 == 0:
    if A == B == C:
        print("-1")
        sys.exit()
    a1 = int(A/2) 
    b1 = int(B/2) 
    c1 = int(C/2) 
    A = b1+c1
    B = a1+c1
    C = a1+b1
    cou += 1
    
print(cou)

Measured memory_bytes: 9204
import sys

N = int(input())
A = [int(x) for x in input().split()]

import collections

c = collections.Counter(A)

S = sorted(c.items(), reverse=True)

max1 = 0
max2 = 0
for s in S:
    if max1 == 0:
        if s[1] >= 4:
            max1 = s[0]
            max2 = s[0]
            break
        elif s[1] >= 2:
            max1 = s[0]
    else:
        if s[1] >= 2:
            max2 = s[0]
            break

print(max1 * max2)


Measured memory_bytes: 21384
#include<bits/stdc++.h>
#define int long long
using namespace std;
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar();bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
const int N = 3e5 + 233;
int a[N], ban[N], vis[N];
set<int> g[N];
int n, ans = 0, res = 0;
char str[N];

inline int dfs(int u, int fat) {
  int ok = 0;
  for(auto v: g[u]) if(v != fat) ok = 1;
  if(!ok) return 0ll;
  int mx = -1e9, se = -1e9;
  for(auto v: g[u]) if(v != fat) {
      int p = dfs(v, u);
      if(p >= mx) se = mx, mx = p;
      else if(p >= se) se = p;
    }
  ans = max(ans, mx);
  ans = max(ans, mx + se + a[u]);
  // cout << u << " " << mx << " " << se << "\n";
  return max(0ll, mx + a[u]);
}

inline void doit(void) {
  queue<int> q;
  for(int i = 1; i <= n; i ++)
    if(g[i].size() == 1 && a[i] == 1) {
      q.push(i);
      for(auto v: g[i])
        g[v].erase(i);
    }
  while(!q.empty()) {
    int u = q.front(); q.pop();
    ban[u] = true;
    for(auto i: g[u]) {
      g[i].erase(u);
      if(g[i].size() == 1 && a[i] == 1) q.push(i);
    }
  }
  for(int i = 1; i <= n; i ++)
    if(!ban[i]) {
      vis[i] = (int) g[i].size();
      res += vis[i] + ((vis[i] & 1) ^ (str[i] == 'W'));
      a[i] = ((vis[i] & 1) ^ (str[i] == 'W')) ? 2 : 0;
    }
  // for(int i = 1; i <= n; i ++)
  //   cout << a[i] << " "; puts("");                                
  // cout << res << "\n";
  for(int i = 1; i <= n; i ++)
    if(!ban[i]) {
      dfs(i, 0);
      break;
    }
  cout << res - ans << "\n";
}

main(void) {
  read(n);
  for(int i = 2; i <= n; i ++) {
    int x, y; read(x); read(y);
    g[x].insert(y); g[y].insert(x);
  }
  scanf("%s", str + 1);
  for(int i = 1; i <= n; i ++)
    a[i] = str[i] == 'B' ? 1 : -1;
  doit();
}


Measured memory_bytes: 33792
X,K,D = map(int,input().split())

if X < 0:
    X = -X

cnt = 0
Q = X//D
R = X%D

if K < Q:
    print(X-K*D)
else:
    if (K - Q)%2 == 0:
        print(abs(R))
    else:
        print(abs(R-D))

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

int main() {
	
	char a[10001];
	int i, j;
	
	while(cin>>a,!cin.eof()) {
		i=0;
		j=0;
		for(int k=1;k<strlen(a)-1;k++) {
			if(a[k]=='O'&&a[k+1]=='I') {
				if(a[k-1]=='J')j++;
				else if(a[k-1]=='I')i++;
				k++;
			}
		}
		cout<<j<<endl<<i<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1144
import sys
input = sys.stdin.readline

N, Q = map(int,input().split())
S = "0"+input()+"0"
TD = [input().rstrip().split() for _ in range(Q)]
l, r = 0, N+1
for t, d in TD[::-1]:
  if t == S[l] and d == "R":
    l -= 1
  elif t == S[l+1] and d == "L":
    l += 1
  if t == S[r] and d == "L":
    r += 1
  elif t == S[r-1] and d == "R":
    r -= 1
print(max(0, r-l-1))

Measured memory_bytes: 40892
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second

int n;

int main() {
	cin >> n;
	vector<ll> vi(3 * n);
	REP(i, 3 * n) {
		cin >> vi[i];
	}
	sort(ALL(vi));
	ll sum = 0;
	REP(i, n) {
		sum += vi[3 * n - 2 - 2 * i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll a[52],b[52];
int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		a[i]=x;b[i]=y;
	}
	ll ans=0;
	for(ll i=0;i<n;i++){
		for(ll j=0;j<n;j++){
			ll sum=0;
			if(i==j){
				continue;
			}
			ll nox=a[j]-a[i];
			ll noy=b[j]-b[i];
			for(ll k=0;k<n;k++){
				for(ll l=0;l<n;l++){
					ll nex=a[l]-a[k];
					ll ney=b[l]-b[k];
					if(nex==nox&&noy==ney){
						sum++;
					}
				}
			}
			ans=max(ans,sum);
		}
	}
	cout << n-ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
h, w = [int(i) for i in input().split(' ')]

m = []
for i in range(h):
    m.append(input())

def valid(d):
    global h, w
    return 0 <= d[0] and d[0] < h and 0 <= d[1] and d[1] < w

def bfs(i, j):
    global m
    dirs = [(0, 1), (0, -1), (1, 0), (-1, 0)]
    index = 0
    q = [(i, j)]
    v = {(i, j): 0}
    while index < len(q):
        item = q[index]
        for d in dirs:
            new_item = (d[0] + item[0], d[1] + item[1])
            if valid(new_item) and m[new_item[0]][new_item[1]] == '.' and new_item not in v:
                v[new_item] = v[item] + 1
                q.append(new_item)
        index += 1
    return max(v.values())

answer = 0

for i in range(h):
    for j in range(w):
        if m[i][j] == '.':
            answer = max(answer, bfs(i, j))

print(answer)

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

char getGrade(int a,int b,int c);

int main() {
	int a,b,c;
	while (1) {
	    cin >> a >> b >> c;
	    if ( a == -1 && b == -1 && c == -1 ) break;
	    cout << getGrade(a,b,c) << endl;
	}
	return 0;
}

char getGrade(int a,int b,int c) {
	if ( a == -1 || b == -1 ) return 'F';
	else if ( a + b >= 80 ) return 'A';
	else if ( a + b < 80 && a + b >= 65 ) return 'B';
	else if ( a + b < 65 && a + b >= 50 ) return 'C';
	else if ( a + b < 50 && a + b >= 30 ) {
		if ( c >= 50 ) return 'C';
		return 'D';
	}
	else if ( a + b < 30 ) return 'F';
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
const double PI = acos(-1);
using namespace std;
typedef long long ll;

/*C++になってるか確認したほうがよくない？WOWWOW*/
/*DP使ったほうがよくない？？WOWWOW*/

int main(){
  int K, A, B; cin>>K>>A>>B;
  for(int i=A; i<=B; i++){
    if(i%K == 0){
      cout<<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;
}

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

#define uint        unsigned int
#define ld          long double
#define int         long long
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        400005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//const int md = 998244353;

/*const int mod = 998244353;
int power(int a,int n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n/2))%mod)%mod;
    return power((a*a)%mod,n/2)%mod;
}
*/


signed main()
{
    showoff;
    int ma = 0,n,s = 0;
    cin >> n;
    FOR(i,1,n+1){
    int x;
    cin >> x;
    ma = max(ma,x);
    s += x;
    }
    if(ma < s-ma)cout << "Yes";
    else cout << "No";

    return 0;
}
//*->for large size of matrix take int not long long ......


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string YES = "Yes";
const string NO = "No";

int main(){
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];
    for (int i=k; i<n; ++i) {
        if (a[i] > a[i-k]) cout << YES << endl;
        else cout << NO << endl;
    }
    return 0;
}


Measured memory_bytes: 3984
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
    int n,m = 0;
    vector<string> s;
    string str;

    cin >> n;

    for(int i = 0; i < n; i++){
        cin >> str;
        s.push_back(str);
    }

    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());

    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 11660
#include <bits/stdc++.h>
using namespace std;
#define FOR(x,to) for(int x=0;x<(to);x++)

int main()
{
    int n;cin>>n;
    long int a[n];
    FOR(i,n){
        cin>>a[i];
    }
    long int minv=a[0],maxv=-1000000000;
    for(int i=1;i<n;i++){
        maxv=max(maxv,a[i]-minv);
        minv=min(minv,a[i]);
    }
    cout<<maxv<<endl;
}


Measured memory_bytes: 4668
//Moh_K_Imar .......
//29/08/2020  ... 5,23.
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll x=a-c; ll y=b-d;
    cout<<x*y<<endl;


    return 0;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

vi par(60);

void init(int n){
  for(int i = 0; i <= n; i++){
    par.at(i) = i;
  }
}

int root(int x){
  if(par.at(x) == x) return x;

  return par.at(x) = root(par.at(x));
}

void unite(int x, int y){
  if(root(x) == root(y)) return;

  par.at(root(x)) = root(y);
}

bool same(int x, int y){
  return root(x) == root(y);
}

int main(){
  int N, M;
  cin >> N >> M;
  vi a(M), b(M);
  for(int i = 0; i < M; i++){
    cin >> a.at(i) >> b.at(i);
  }
  int counter = 0;
  for(int i = 0; i < M; i++){
    init(N);
    for(int j = 0; j < M; j++){
      if(i == j) continue;
      unite(a.at(j), b.at(j));
    }
    if(!same(a.at(i), b.at(i))) counter++;
  }
  cout << counter << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int a = str.length();
        
        if(str.charAt(a-1) == '3'){
            System.out.println("bon");
        }else if(str.charAt(a-1) == '0' || str.charAt(a-1) == '1' || 
        str.charAt(a-1) == '6' || str.charAt(a-1) == '8'){
            System.out.println("pon");
        }else{
            System.out.println("hon");
        }
    }
}

Measured memory_bytes: 35580
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    string S;cin>>S;
    while(S.size()>0){
        if(S.substr(S.size()-5)=="erase"){
            S.erase(S.size()-5);
        }else if(S.substr(S.size()-5)=="dream"){
            S.erase(S.size()-5);
        }else if(S.substr(S.size()-6)=="eraser"){
            S.erase(S.size()-6);
        }else if(S.substr(S.size()-7)=="dreamer"){
            S.erase(S.size()-7);
        }else{
            break;
        }
    }
    cout<<(S.size()?"NO":"YES")<<endl;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  int n, k;
  cin >> n >> k;
  if(n % k == 0) cout << 0;
  else cout << 1;
  return 0;
}


Measured memory_bytes: 256
//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
using namespace std;
int d[200008];
int main()
{
 	//freopen("","r",stdin);
	//freopen("","w",stdout);
	int n;cin>>n;
	for(int i=0;i<n;i++) 
	{
		int a;cin>>a;d[a]++,d[a+1]++;if(a>0)d[a-1]++;
	}
	int ma,mi;ma=-1;
	for(int i=0;i<=100008;i++)
	{
		if(d[i]>ma) ma=d[i],mi=i;
	}
	cout<<ma;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(void){
	int i,n;
	long int min=1000000,max=-1000000,inpt;
	long long int sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%ld",&inpt);
		if(min>inpt){
			min=inpt;
		}
		if(max<inpt){
			max=inpt;
		}
		sum+=inpt;
	}
printf("%d %d %lld\n",min,max,sum);
return 0;
}

Measured memory_bytes: 600
// Problem : A - Strings
// Contest : AtCoder Beginner Contest 149
// URL : https://atcoder.jp/contests/abc149/tasks/abc149_a
// Memory Limit : 1024,000000 MB 
// Time Limit : 2000,000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

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

  cout.precision(16);
  cout << fixed;
  
  string s;
  string t;
  cin >> s >> t;
  
  cout << t << s;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <sys/time.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int N, K, C;
vector<int> sub(const string &S) {
    int N = S.size();
    int cur = 0, last = -C-1;
    vector<int> res(N+1, 0);
    for (int i = 0; i < N; ++i) {
        if (i - last > C && S[i] == 'o') ++cur, last = i;
        res[i+1] = cur;
    }
    return res;
}

void solve(const string &S) {
    const auto &left = sub(S);
    string T = S;
    reverse(T.begin(), T.end());
    const auto &right = sub(T);
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'x') continue;
        if (left[i] + right[N-i-1] < K) cout << i+1 << endl;
    }
}

int main() {
    string S;
    cin >> N >> K >> C >> S;
    solve(S);
}

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

int main(){
     int A, B, C;
     cin >> A >> B >> C;
     if(A>= 1&&A<=100&&B>= 1&&B<=100&&C>= 1&&C<=100){
               if(A==B&&B==C){
                                    cout << "Yes" << endl;    
               }
              else cout<< "No" << endl;
  
     }
    else cout<< "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<iomanip>
#include<map>
#define mod 1000000007
#define int long long int
bool palindrome(string str)
{
	int i,l=str.size();
	for(i=0;i<l/2;i++)
	{
		if(str[i]!=str[l-i-1])
		   return false;
	}
	return true;
	
}
int32_t main()
{
     int n;
     cin>>n;
     map<int,int> mp;
     int j;
     int arr[n];
     for(j=0;j<n;j++)
     {
		 int x;
		 cin>>arr[j];
		 x=arr[j];
		 mp[x]++;
	 }
	 int answer=0;
	 for(auto p:mp)
	 {
		 int val=p.second;
		 answer=answer+(val*(val-1))/2;
	 }
	 for(j=0;j<n;j++)
	 {
		 int x=arr[j];
		 auto it=mp.find(x);
		 int ans=answer-(it->second-1);
		 cout<<ans<<endl;
	 }
}


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

int N;
set<int> mochi_dia;
int d;

void input_info(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> d;
        mochi_dia.insert(d);
    }
}

void solve(){
    cout << mochi_dia.size() << endl;
}

int main(){
    input_info();
    solve();
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 998244353;

int main(){
    ll N; cin >> N;
    vll A(N);
    ll s = 0;
    rep(i, 0, N){
        cin >> A[i];
        s += A[i];
    }
    Map m;
    rep(i, 0, N){
        m[A[i]]++;
    }
    ll q; cin >> q;
    rep(i, 0, q){
        ll a, b; cin >> a >> b;
        ll r = m[a];
        m[a] = 0;
        m[b] += r;
        s = s - a*r + b*r;
        prtl(s);
    }
    //prt(s);
}

Measured memory_bytes: 9948