akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

struct Edge{
    int from, to;
    ll cost;
    Edge(int from,int to,ll cost): from(from),to(to), cost(cost){}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

bool operator < (const Edge &e, const Edge &f){
    return e.cost > f.cost;
}

struct UF {
	vector<int> data;
	UF(int size) : data(size, -1) { }
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool find(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

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

    int n,m;cin>>n>>m;
    Graph g(n);
    priority_queue<Edge> pq;
    for(int i=0;i<m;i++){
      int a,b;cin>>a>>b;a--;b--;
      ll c;cin>>c;
      pq.push(Edge(a,b,c));
      g[a].push_back(Edge(a,b,c));
      g[b].push_back(Edge(b,a,c));
    }
    ll sum=0;
    UF uf(n);
    Graph mst(n);
    while(!pq.empty()){
      Edge e=pq.top();pq.pop();
      if(uf.find(e.from,e.to)) continue;
      uf.unite(e.from,e.to);
      mst[e.from].push_back(Edge(e.from,e.to,e.cost));
      mst[e.to].push_back(Edge(e.to,e.from,e.cost));
      sum += e.cost;
    }
    vector<vector<ll>> dis(n,vector<ll>(n,-1));
    for(int i=0;i<n;i++){
      queue<int> q;
      dis[i][i]=0;
      q.push(i);
      while(!q.empty()){
        int v=q.front();q.pop();
        for(int j=0;j<(int)mst[v].size();j++){
          int next=mst[v][j].to;
          if(dis[i][next]!=-1) continue;
          dis[i][next]=max(dis[i][v], mst[v][j].cost);
          q.push(next);
        }
      }
    }
    int q;cin>>q;
    for(int i=0;i<q;i++){
      int s,t;cin>>s>>t;s--;t--;
      cout<<sum-dis[s][t]<<endl;
    }
}


Measured memory_bytes: 152808
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(int i = 0;i < n;++i)
#define LONGINF 1000000000000000000
int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int cnt = 0;
	for (int i = 0;i < n;++i) {
		int tmp;
		cin >> tmp;
		if (tmp < a || tmp >= b) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int a = Integer.parseInt(sc.next()) , b = Integer.parseInt(sc.next()) , c = Integer.parseInt(sc.next()) , d = Integer.parseInt(sc.next()) , e = b + c - d , f = - a + c + d;
		ou.print(e + " " + f + " ");
		a = c; b = d; c = e; d = f; e = b + c - d; f = - a + c + d;
		ou.println(e + " " + f);
		sc.close();
		ou.flush();
	}
}

Measured memory_bytes: 39204
#include <bits/stdc++.h>
using namespace std;
int main(){
    int min,sum=0,b=1;
    vector<int> a(5);
    for(int i=0;i<5;i++){
        cin>>a.at(i);
        if(!i)min=a.at(i);
        if(((a.at(i)%10)<(min%10))&&a.at(i)%10) min=a.at(i);
    }
    for(int i=0;i<5;i++){
        if(b&&a.at(i)==min){
            sum+=min;
            b=0;
        }else{
            sum+=a.at(i)/10*10;
            if(a.at(i)%10) sum+=10;
        }
    }
    cout<<sum<<"\n";
}

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

a_max = max(a)
a_min = min(a) - n

t = (a_min + a_max) // 2

while (a_min <= a_max):
    plus_minus = 0
    for i,data in enumerate(a):
        if data < t + i + 1:
            plus_minus -= 1
        elif data > t + i + 1:
            plus_minus += 1

    if (plus_minus == 0):
        break
    elif (plus_minus > 0):
        a_min = t + 1
    elif (plus_minus < 0):
        a_max = t - 1
    t = (a_min + a_max) // 2

kanasisa = 0
for i,data in enumerate(a):
    kanasisa += abs(data - (t + i + 1))

print(kanasisa)

Measured memory_bytes: 26180
//#include <ext/pb_ds/assoc_container.hpp> 
 //#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power(((((a)%mod)*((a)%mod))%mod),b/2)%mod;
    else return (((a)%mod)*(power(((((a)%mod)*((a)%mod))%mod),b/2)%mod))%mod;
}
inline ll inverse(ll a,ll md) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
  
  
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); //for randomized solution
const int ce=1e9+7;
ll fast_mod(ll input)
{
    return input < ce ? input : input%ce;
}
int32_t main()
{
    IOS
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif    

	int k;
	cin>>k;
	map<int,int> m;
	int c=0;
	int rem=0;
	while(1)
	{
		if(m[rem])
		{
			cout<<-1;
			return 0;
			break;
		}
		m[rem]=1;
		rem=(rem*10+7)%k;
		c++;
		if(rem==0)
			break;
	}
	cout<<c;

}



Measured memory_bytes: 66096
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;
// const int INF=1010101010;
using Graph = vector<vector<int>>;

int main() {
  int n, m;
  cin >> n >> m;
  ll total = 0;
  vector<int> a(m);
  rep(i, m) cin >> a[i];
  rep(i, m) { total += a[i]; }
  if (n - total < 0)
    cout << -1 << endl;
  else
    cout << n - total << endl;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

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

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

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

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

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

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

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code
int main(int argc, char *argv[])
{
	int n;
	cin >> n;
	VL a(n);
	cin >> a;
	VL ra(n+1);
	ra[0] = 0;
	std::map<LL, LL> mp;
	for (int i = 0; i < n; ++i) {
		ra[i+1] = ra[i] + a[i];
		mp[ra[i+1]]++;
	}
	LL ans = 0;
	for (auto i : mp) {
		ans += (i.second * (i.second-1)) / 2;
	}
	ans += mp[0];
	cout << ans << endl;
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int n;
  cin>>n;
  ll l0 = 2, l1 = 1;
  n--;
  while(n--){
    swap(l0,l1); l1+=l0;
  }
  cout<<l1<<endl;
  return 0;
}


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

int main() {
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  if ((a1 + a2 + a3) >= 22) {
    cout << "bust" << endl;
  } else {
    cout << "win" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class A_166_
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            string S = Console.ReadLine();
            string result = "";
            if (S == "ABC")
            {
                result = "ARC";
            }
            else
            {
                result = "ABC";
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 25688
def solve():
    from collections import defaultdict
    from fractions import Fraction
    n = int(input())
    d = defaultdict(int)
    for i in range(n):
        x = Fraction(input())
        x *= 10 ** 9
        cnt2, cnt5 = 0, 0
        while x % 5 == 0:
            x //= 5
            cnt5 += 1
        while x % 2 == 0:
            x //= 2
            cnt2 += 1
        d[(cnt2, cnt5)] += 1
    lis = list(d)
    ans_0 = 0
    ans_f = 0
    for i, (a, b) in enumerate(lis):
        k = d[(a, b)]
        if a >= 9 and b >= 9:
            ans_0 += k * (k - 1) // 2
        for x, y in lis[i + 1:]:
            l = d[(x, y)]
            if a + x >= 18 and b + y >= 18:
                ans_f += k * l
    print(ans_0 + ans_f)
    return


solve()


Measured memory_bytes: 85348
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();

    if(1==k)
      System.out.println(0);
    else
      System.out.println(n-k);
  }
}

Measured memory_bytes: 23124
A,B = gets.split.map &:to_i

def g(x)
#  (1..x).reduce(:^)
  return 0 if x == 0
  ans = 0
  (1..x.bit_length).each{ |i|
    b = 1 << i
    h = b/2
    s = (x+1) / b * h + [(x+1)%b - h, 0].max
    ans += (s % 2) << (i-1)
  }
  ans
end

p g(B) ^ g(A-1)

Measured memory_bytes: 1916
#include <stdio.h>
int main(void){
    int a,b;
    //a 年齢
    //b 正規運賃
    scanf("%d %d",&a,&b);
    if (a >= 13){
        //
    }else if (a >= 6 && a <= 12){
        b = b / 2;
    }else{
        b = 0;
    }
    printf("%d",b);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll p=1e9+7;
ll n,m,f[2010][2010];
ll ksm(ll x,ll y){
	ll xlh=1;
	if(y<0)return 1;
	while(y){
		if(y&1)xlh=xlh*x%p;
		x=x*x%p;
		y/=2;
	}
	return xlh;
}
int main(){
	ll i,j;
	scanf("%lld%lld",&n,&m);
	for(i=0;i<=n;i++)f[0][i]=1;
	for(i=1;i<n;i++){
		for(j=0;j<=i;j++){
			f[i][j]=f[i-1][j];
			if(j)f[i][j]=(f[i][j]+f[i][j-1])%p;
		}
		for(j=i+1;j<n;j++)f[i][j]=f[i][i];
	}
	if(m>1)f[n-1][m-1]=(f[n-1][m-1]-f[n-1][m-2]+p)%p;
	printf("%lld",f[n-1][m-1]*ksm(2,n-m-1)%p);
}

Measured memory_bytes: 31616
#include<iostream>
#include<cmath>
using namespace std;
int gcd(int x, int y){
  int X = max(x,y);
  int Y = min(x,y); 
  int mod = X % Y;
  if(mod == 0) 
    return Y;
  else 
    return gcd(Y, X % Y); 
}

int main(){
  int x, y;
  cin >> x >> y;
  cout << gcd(x,y) << "\n";
}

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

const bool DEBUG = false;

long long N, M, P;
vector<long long> A, B, C;

using Graph = vector<vector<pair<int, int>>>;

void input() {
  cin >> N >> M >> P;
  A = vector<long long>(M);
  B = vector<long long>(M);
  C = vector<long long>(M);
  for (size_t i = 0; i < M; i++) {
    cin >> A[i] >> B[i] >> C[i];
    A[i]--;
    B[i]--;
  }
}

bool bellman_ford(const Graph& graph, const long long start,
                  vector<long long>& distance) {
  // スタートノードから徐々に最短経路が伝搬していくイメージ．幅優先
  const long long V = graph.size();
  distance[start] = 0;
  for (int i = 0; i < V; ++i)
    for (int v = 0; v < V; ++v)
      for (auto& e : graph[v]) {
        if (distance[v] == INT64_MAX) continue;
        if (distance[e.first] > distance[v] + e.second) {
          distance[e.first] = distance[v] + e.second;
          if (i == V - 1) return true;  // 到達できた．
        }
      }
  return false;  // V^2くらい試して到達できなければfalse？ほんま？
}

int main(int argc, char const* argv[]) {
  input();

  vector<bool> visited(N, false);
  {
    vector<vector<int>> graph(N);
    for (size_t i = 0; i < M; i++) graph[B[i]].emplace_back(A[i]);
    function<void(int)> dfs = [&](int v) {
      visited[v] = true;
      for (int nxt : graph[v]) {
        if (visited[nxt]) continue;
        dfs(nxt);
      }
    };
    dfs(N - 1);
  }

  Graph graph(N);
  vector<long long> distance(N, INT64_MAX);

  for (size_t i = 0; i < M; i++) {
    if (!visited[A[i]] || !visited[B[i]]) continue;  // 無関係ノードの削除
    graph[A[i]].emplace_back(make_pair(B[i], P - C[i]));
  }
  bool is_acyclic = bellman_ford(graph, 0, distance);

  if (is_acyclic)
    cout << -1 << endl;
  else
    cout << max(-distance[N - 1], 0ll) << endl;

  return 0;
}


Measured memory_bytes: 640
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

	ll lp = 0;
	int n, p;
	char c;
	REP(i, q) {
		cin >> n >> c >> p;
		if(c == '(') {
			lp += p;
		} else {
			lp -= p;
		}

		if(lp == 0) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1156
import sys
input = sys.stdin.readline
from collections import *

def dfs(now):
    if len(now)==N:
        print(''.join(now))
        return
    
    M = max(now)
    
    for i in range(ord(M)-ord('a')+2):
        now.append(alpha[i])
        dfs(now)
        now.pop()

N = int(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'
dfs(deque(['a']))

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

int main(){
    int n, i, t, res = 100000;
    cin >> n;
    int w[n];
    for(i=0; i<n; i++){
        cin >> t;
        if(i == 0){
            w[i] = t;
        }else{
            w[i] = w[i-1] + t;
        }
    }
    for(i=0; i<n-1; i++){
        res = min(res, abs(w[n-1]-2*w[i]));
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
int a,b,d=0,r=0;
double f=0;
scanf("%d %d",&a,&b);
d=a/b;
r=a%b;
f=(double)a/b;
printf("%d %d %lf\n",d,r,f);
return 0;
}

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

int main() {
  int n, l;
  cin >> n >> l;
  int ans = l, sum = l;
  for (int i = 2; i <= n; i++) {
    sum += l + i - 1;
    if (abs(l + i - 1) < abs(ans)) {
      ans = l + i - 1;
    }
  }
  cout << sum - ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#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 REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
#define asn ans
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

int main() {
	int a, b, c, d; CI a >> b >> c >> d;
	CO min(a, b) + min(c, d) EN;
	return 0;
}

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

using namespace std;
typedef long long ll;



struct UnionFind {
public:
    
    vector<int> par;
    vector<int> node;
    
    UnionFind(int N){
        par.resize(N);
        rep(i,N) par[i] = i;
        node.assign(N,1);
    }
    
    int find(int a){
        if(par[a] == a) return a;
        else return par[a] = find(par[a]);
    }
    
    void connect(int a, int b){
        a = find(a);
        b = find(b);
        if(a == b) return;
        
        if(node[a] < node[b]){
            node[b] += node[a];
            node[a] = 0;
            par[a] = b;
        }else{
            node[a] += node[b];
            node[b] = 0;
            par[b] = a;
        }
    }
    
    bool same(int a, int b){
        return find(a) == find(b);
    }
    
};




int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> a(M),b(M);
    rep(i,M) cin >> a[i] >> b[i];
    rep(i,M) a[i]--,b[i]--;
    
    int ans = 0;
    
    rep(i,M){
        UnionFind uni(N);
        
        rep(j,M){
            if(j == i) continue;
            uni.connect(a[j],b[j]);
        }
        
        rep(j,N){
            if(j == 0) continue;
            if(!uni.same(0,j)){
                ans++;
                break;
            }
        }
        
        
        

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



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
   int n,i;
   cin>>n;
   int a[55];
   long long int z=0;
   for(i=1;i<=n;i++)
   {
   	cin>>a[i];
   }
   int j;
   for(i=1;i<n;i++)
   {
   	for(j=i+1;j<=n;j++)
   {
   	  z=z+a[i]*a[j];
   	  
   }
   }
   cout<<z<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<utility>
#include<stack>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
const int maxn = 1e5 + 5;
char str[maxn];
int main() {
	int s = -1, e = -1;
	scanf("%s", str);
	int len = strlen(str);
	for(int i = 0; str[i]; i++) {
		if(str[i] == str[i + 1]) {
			s = i + 1;
			e = i + 2;
			break;
		} else if(str[i] == str[i + 2]) {
			s = i + 1;
			e = i + 3;
			break;
		}
	}
	cout << s << ' ' << e << '\n';
	return 0;
}


Measured memory_bytes: 384
use std::io::stdin;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let l1 : Vec<i64> = buf.split_whitespace().filter_map(|x| x.parse().ok()).collect();
    let x = l1[0];
    let n = l1[1];

    buf.clear();
    stdin().read_line(&mut buf).unwrap();
    let l2 : Vec<i64>= buf.split_whitespace().filter_map(|x| x.parse().ok()).collect();
    let mut answer = -1;
    for p in 0 .. 102 {
        if l2.contains(&p) {
            continue;
        }

        if (p - x).abs() < (answer - x).abs() {
            answer = p;
        }
    }
    print!("{}",answer );
}


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

int main(){
  cin.tie(0);
 	ios::sync_with_stdio(false);
  int N, A;
  cin >> N;
  set<int> s;
  while(N--){
    cin >> A;
    if(s.count(A)){
      s.erase(A);
    }else{
      s.insert(A);
    }
  }
  cout << s.size() << "\n";
  return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int x, y;
    std::cin >> x >> y;
    int ret = std::max(0, 4 - x) * 100000 + std::max(0, 4 - y) * 100000;
    if (x == 1 && y == 1) ret += 400000;
    std::cout << ret << std::endl;

    return 0;
}


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

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int a = y2 - y1;
    int b = x2 - x1;
    int x4 = x1 - a;
    int y4 = y1 + b;
    int x3 = x4 + b;
    int y3 = y4 + a;     
    printf("%d %d %d %d\n", x3, y3, x4, y4);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define y1 adfasfafa
const int maxn = 1e3+7;
typedef long long ll;

int n,m;
int ar[maxn];
char ch[maxn][maxn];
int vis[maxn][maxn];
queue<pair<int,int>> qu;
int desll[4][2] = {
    {1,0},
    {-1,0},
    {0,1},
    {0,-1}
};
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)scanf("%s",ch[i]);
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(ch[i][j]=='#'){
                qu.push(make_pair(i,j));
                vis[i][j] = 1;
            }
        }
    }
    int mx=1;
    while(qu.size()){
        int i=qu.front().first, j=qu.front().second;qu.pop();
        mx = max(mx, vis[i][j]);
        for(int in=0;in<4;in++){
            int nx = desll[in][0] + i;
            int ny = desll[in][1] + j;
            if(nx>=0 && nx<n && ny>=0 && ny<m && !vis[nx][ny]){
                vis[nx][ny] = vis[i][j]+1;
                qu.push(make_pair(nx,ny));
            }
        }
    }
    printf("%d\n", mx-1);

    

    return 0;
}


Measured memory_bytes: 13328
f=lambda:map(int,input().split())
h,w,n=f()
d={}
while n:
 n-=1;x,y=f()
 for i in range(9):
  a=(x+i%3,y+i//3)
  if h>=a[0]>2<a[1]<=w:d[a]=d.get(a,0)+1
c=[0]*9
for i in d:c[d[i]-1]+=1
print((h-2)*(w-2)-sum(c),*c)

Measured memory_bytes: 166524
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    A = []
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))

    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    A.append(int(input_raw[0]))
    input_raw = read_func().strip().split()
    k = int(input_raw[0])

    if A[len(A) - 1] - A[0] > k:
        print ":("
        return
    print "Yay!"


if __name__ == '__main__':
    main()


Measured memory_bytes: 2932
#include <iostream>
#include <string>

using namespace std;
int main(){
	int n,m,i,j,c,d,k;
	string s,t;
	cin >> s >> t;
	n = s.size();
	m = t.size();
	d = 0;
	for(i=0;i<=n-m;i++){
		c = 0;
		for(j=i;j<i+m;j++){
			if(s[j] == t[j-i] || s[j] == '?'){
				c += 1;
			}
		}
		if(c == m){
			d = 1;
			k = i;
		}
	}
	if(d == 0){
		cout << "UNRESTORABLE" << endl;
	}else{
		for(i=0;i<k;i++){
			if(s[i] == '?'){
				s[i] = 'a';
			}
		}
		for(i=k;i<k+m;i++){
			s[i] = t[i-k];
		}
		for(i=k+m;i<n;i++){
			if(s[i] == '?'){
				s[i] = 'a';
			}
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 256
def main():
    num = [int(i) for i in input().split()]
    num.sort()
    ans = 0
    ans += (num[2]-num[1])
    ans+=(num[1]-num[0])//2
    if (num[1]-num[0])%2==1:
        ans+=2
    print(ans)


if __name__ == '__main__':
    main()

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

int main(){
    int w,a,b;
    cin >> w >> a >> b;
    if (a > b + w){
        cout << a - (b + w);
    }
    else if (a + w < b){
        cout  << b - (a + w);
    }
    else cout << '0';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
int n,q,pos=0,v[100010];
map<int,int>mp;
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>n>>q;
    rep(i,n)v[i]=i;
    mp[0]=1,mp[1]=1;
    rep(i,q){
        int a,b;
        cin>>a>>b;
        a--,b--;
        if(a==pos){
            pos=b;
        }
        else if(b==pos){
            pos=a;
        }
        swap(v[a],v[b]);
        if(pos!=0)mp[v[pos-1]]++;
        if(pos+1!=n)mp[v[pos+1]]++;
    }
    cout<<mp.size()<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#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 all(v) v.bigin(),v.end()
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define R(a) a=sqrt(a)
#define POW(a,b) a=pow(a,b)
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
bool is_integer(long double x){
    return floor(x)==x;
}
 
int main(){
    FAST;
    ll n;
    ll ans=0;
    cin>>n;
    ll l[n];
    rep(i,n){
        cin>>l[i];
    }
    rep(i,n-2){
        rep(j,n-1){
            rep(k,n){
                if(i<j&&j<k&&l[i]!=l[j]&&l[j]!=l[k]&&l[i]!=l[k]){
                    if(l[i]>l[j]&&l[i]>l[k]&&l[i]-l[j]-l[k]<0){
                        ans++;
                    }
                    else if(l[j]>l[i]&&l[j]>l[k]&&l[j]-l[i]-l[k]<0){
                        ans++;
                    }
                    else if(l[k]>l[i]&&l[k]>l[j]&&l[k]-l[j]-l[i]<0){
                        ans++;
                    }
                }
                
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    ll n,k;cin>>n>>k;
    ll a=n%k;
    cout<<min(a,k-a);
}

Measured memory_bytes: 256
#include<iostream>
#define MAX 600
using namespace std;

int d, area, sum;

int f(int x)
{
	return x*x;
}

int main()
{
	while (cin >> d)
	{
		sum = 0;
		for (int i = 0; i < MAX / d; i++)
		{
			area = d*(f(i*d));
			sum += area;
		}
		cout << sum << endl;
	}
	return 0;
}

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

using namespace std;

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

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

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	int ans = 0;
	for (int i = 1; i < t+1; i++) {
		if (i%a == 0) {
			ans++;
		}
	}

	cout << ans*b << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp std::make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
//const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll MOD=100000;
const ll MAX=1e7;
const ll INF=(1ll<<60);
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
struct Binary_indexed_tree{
    int N;
    vi bit;
    Binary_indexed_tree(int n):N(n){
        bit.resize(N+1,0);
    }
    void add(int x,int a){
        for(x;x<=N;x+=(x&-x)) bit[x]+=a;
    }
    ll sum(int x){
        ll ret=0;
        for(x;x>0;x-=(x&-x)) ret+=bit[x];
        return ret;
    }
};
struct Union_Find{
    ll N;
    vi par;
    vi siz;
    Union_Find(int n):N(n){
        par.resize(N);
        siz.resize(N,1);
        rep(i,0,N) par[i]=i;
    }
    ll root(ll X){
        if(par[X]==X) return X;
        return par[X]=root(par[X]);
    }
    bool same(ll X,ll Y){
        return root(X)==root(Y);
    }
    void unite(ll X,ll Y){
        X=root(X);
        Y=root(Y);
        if(X==Y) return;
        par[X]=Y;
        siz[Y]+=siz[X];
        siz[X]=0;
    }
    ll size(ll X){
        return siz[root(X)];
    }
};
ll modpow(ll X,ll Y){
    ll sum=X,cnt=1;
    vi A;
    while(cnt<=Y){
        A.pb(sum);
        sum*=sum;
        sum%=MOD;
        cnt*=2;
    }
    int M=A.size();
    ll ret=1;
    REP(i,1,M){
        if(Y>=(1ll<<M-i)){
            Y-=(1ll<<M-i);
            ret*=A[M-i];
            ret%=MOD;
        }
    }
    return ret;
}
ll fac[MAX],finv[MAX],inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(ll n,ll r){
    if(n<r||n<0||r<0) return 0;
    return fac[n]*finv[r]%MOD*finv[n-r];
}
signed main(){
    ll H,W; cin>>H>>W;
    vector<string> S(H);
    rep(i,0,H) cin>>S[i];
    ll ans=0;
    rep(i,1,W){
        vii sum(H+1,vi(H+1));
        REP(j,1,H){
            REP(k,1,H){
                sum[j][k]=sum[j-1][k-1];
                if(S[j-1][i-1]==S[k-1][i]) sum[j][k]++;
            }
        }
        vii dp(H+1,vi(H+1,INF));
        dp[H][H]=0;
        per(j,H,0){
            per(k,H,0){
                if(j<H){
                    dp[j][k]=std::min(dp[j][k],dp[j+1][k]+sum[j+1][k]);
                }
                if(k<H){
                    dp[j][k]=std::min(dp[j][k],dp[j][k+1]+sum[j][k+1]);
                }
            }
        }
        ans+=dp[0][0];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1904
#include<iostream>

using namespace std;

int main() {
  int n, y, m, d;
  int totalDays = 999*(5*19+5*20) + 333*5;
  //cout<<totalDays<<endl<<endl;
  cin>>n;
  for(int i=0; i<n; i++) {
    int ans = totalDays;
    cin>>y>>m>>d;
    //cout<<y<<" "<<m<<" "<<d<<endl;
    for(int a=1; a<=y; a++) {
      if(a != y) {
        for(int b=1; b<=10; b++) {
	  if(a%3==0 || b%2==1) {
	    ans -= 20;
	  }
	  else {
	    ans -= 19;
	  }
	}
      }
      else {
	for(int b=1; b<m; b++) {
	  if(a%3==0 || b%2==1) {
	    ans -= 20;
	  }
	  else {
	    ans -= 19;
	  }
	}
	ans -= d-1;
      }
    }
    
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 404;
const ll INF = LLONG_MAX/3;

int n;
ll a[N];

ll sa[N];
ll s(int l, int r){
    ll ret = sa[r];
    if(l>0) ret -= sa[l-1];
    return ret;
}

ll dp[N][N];
ll dfs(int l, int r){
    if(l>=r) return 0;
    if(dp[l][r]>=0) return dp[l][r];

    ll ret = INF;
    for(int i=l; i<r; ++i) ret = min(ret, dfs(l,i)+dfs(i+1,r));
    ret += s(l,r);
    return dp[l][r] = ret;
}

int main(){
    cin >>n;
    rep(i,n) cin >>a[i];

    sa[0] = a[0];
    for(int i=1; i<n; ++i) sa[i] = sa[i-1]+a[i];

    memset(dp,-1,sizeof(dp));
    cout << dfs(0,n-1) << "\n";
    return 0;
}


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

int main()
{
    int a, b;
    scanf("%d %d", &a, &b);
    if (a == b)
    {
        printf("a == b\n");
    }
    else if (a > b)
    {
        printf("a > b\n");
    }
    else
    {
        printf("a < b\n");
    }
}


Measured memory_bytes: 3144
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
using namespace std;
int n,m,q,a[2005][2005],c[2005][2005],r[2005][2005];
int main(){
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j)scanf("%1d",a[i]+j);
    }
    for(int i=1;i<=n;++i){
        for(int j=1;j<m;++j)if(a[i][j]&&a[i][j+1])r[i][j]=1;
    }
    for(int i=1;i<n;++i){
        for(int j=1;j<=m;++j)if(a[i][j]&&a[i+1][j])c[i][j]=1;
    }
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j){
            a[i][j]+=a[i-1][j]+a[i][j-1]-a[i-1][j-1];
            r[i][j]+=r[i-1][j]+r[i][j-1]-r[i-1][j-1];
            c[i][j]+=c[i-1][j]+c[i][j-1]-c[i-1][j-1];
        }
    }
    while(q--){
        int U,D,L,R;
        scanf("%d%d%d%d",&U,&L,&D,&R);
        int x=a[D][R]-a[D][L-1]-a[U-1][R]+a[U-1][L-1];
        int y=r[D][R-1]-r[D][L-1]-r[U-1][R-1]+r[U-1][L-1];
        int z=c[D-1][R]-c[D-1][L-1]-c[U-1][R]+c[U-1][L-1];
        printf("%d\n",x-y-z);
    }
   // system("pause");
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int64_t> lucas(N + 1);
  lucas.at(0) = 2;
  lucas.at(1) = 1;
  
  for (int i = 2; i < N + 1; i++) {
    lucas.at(i) = lucas.at(i - 1) + lucas.at(i - 2);
  }
  cout << lucas.at(N) << endl;
}


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

public class Main {

	// ?´?
	static int paper[][] = new int[10][10];
	// 1???????????????
	static int deepCell = 0;
	// ??????????????????????????????
	static int clearCell = 0;

	public static void main(String[] args) throws IOException {

		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String str;

		while (true) {
			str = br.readLine();
			if (str == null || str.isEmpty()) {
				break;
			}

			// ??\???????????????
			String[] input = str.split(",");

			// ??????????????????????????°??????????????????
			int x = Integer.parseInt(input[0]);
			int y = Integer.parseInt(input[1]);
			int size = Integer.parseInt(input[2]);

			// size?????§??????????????£???????????????????????????????????????
			switch (size) {
			case 1:
				small(x, y);
				break;
			case 2:
				medium(x, y);
				break;
			case 3:
				large(x, y);
				break;
			}
		}
		printClearCell();
		printDeepCell();
	}

	// ?????????????????????????????????????????????
	private static void printClearCell() {
		for (int i = 0; i < 10; ++i) {
			for (int j = 0; j < 10; ++j) {
				if (paper[i][j] == 0) {
					clearCell++;
				}
			}
		}
		System.out.println(clearCell);
	}

	// ?????????????????????????????????
	private static void printDeepCell() {
		for (int i = 0; i < 10; ++i) {
			for (int j = 0; j < 10; ++j) {
				if (deepCell < paper[i][j]) {
					deepCell = paper[i][j];
				}
			}
		}
		System.out.println(deepCell);
	}

	private static void small(int x, int y) {
		// ???????????´??????????????¨???
		paper[x][y]++;
		// ??????????????????????????¨
		if (y != 0) {
			paper[x][y - 1]++;
		}
		// ??????????????????????????¨
		if (y != 9) {
			paper[x][y + 1]++;
		}
		// ??????????????????????????¨
		if (x != 0) {
			paper[x - 1][y]++;
		}
		// ??????????????????????????¨
		if (x != 9) {
			paper[x + 1][y]++;
		}
	}

	private static void medium(int x, int y) {
		small(x, y);
		// ???????????????????????????
		if (x >= 1 && y >= 1) {
			paper[x - 1][y - 1]++;
		}
		// ???????????????????????????
		if (x <= 8 && y >= 1) {
			paper[x + 1][y - 1]++;
		}
		// ???????????????????????????
		if (x >= 1 && y <= 8) {
			paper[x - 1][y + 1]++;
		}
		// ???????????????????????????
		if (x <= 8 && y <= 8) {
			paper[x + 1][y + 1]++;
		}
	}

	private static void large(int x, int y) {
		medium(x, y);
		// ???????????´???2??????
		if (x >= 2) {
			paper[x - 2][y]++;
		}
		// ???????????´???2??????
		if (x <= 7) {
			paper[x + 2][y]++;
		}
		// ???????????´???2??????
		if (y >= 2) {
			paper[x][y - 2]++;
		}
		// ???????????´???2??????
		if (y <= 7) {
			paper[x][y + 2]++;
		}
	}
}

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

int main() {
	string s;
	cin >> s;
	int i,j;
	for(i=0; i<s.size()-1; i++){
		for(j=i+1; j<s.size(); j++){
			if(s[i]==s[j]){
				cout << "no"; return 0;
			}
		}
	}
	cout << "yes";
}

Measured memory_bytes: 256
def dijkstra(g, s)
  def enq(pq, val)
    pq << val
    cd = pq.size
    pr = cd / 2
    until pr.zero? || (pq[pr - 1] <=> pq[cd - 1]) < 0
      pq[pr - 1], pq[cd - 1] = pq[cd - 1], pq[pr - 1]
      cd = pr
      pr = cd / 2
    end
  end

  def deq(pq)
    pq[0], pq[-1] = pq[-1], pq[0]
    rs = pq.delete_at(-1)
    unless pq.empty?
      pr = 1
      cd = [pr * 2, pr * 2 + 1].select { |i| pq[i - 1] }.min_by { |i| pq[i - 1] }
      until cd.nil? || (pq[pr - 1] <=> pq[cd - 1]) < 0
        pq[pr - 1], pq[cd - 1] = pq[cd - 1], pq[pr - 1]
        pr = cd
        cd = [pr * 2, pr * 2 + 1].select { |i| pq[i - 1] }.min_by { |i| pq[i - 1] }
      end
    end
    rs
  end

  pq = []
  d = Array.new(g.size) { Float::INFINITY }
  d[s] = 0
  enq(pq, [0, s])

  until pq.empty?
    v_cost, v = deq(pq)
    next if d[v] < v_cost
    g[v].each do |e|
      if d[e.to] > d[v] + e.cost
        d[e.to] = d[v] + e.cost
        enq(pq, [d[e.to], e.to])
      end
    end
  end

  d
end

Edge = Struct.new('Edge', :to, :cost)

v, e, r = gets.split.map(&:to_i)
g = Array.new(v) { [] }
e.times do
  s, t, d = gets.split.map(&:to_i)
  g[s] << Edge.new(t, d)
end

dijkstra(g, r).each do |sum|
  puts (sum == Float::INFINITY ? 'INF' : sum)
end

Measured memory_bytes: 62384
#include <bits/stdc++.h>
using namespace std;
#define int long long

int f(int i){
    int ans=-1;
    while(i){
        ans=i;
        i/=10;
    }
    return ans;
}

signed main() {
    map<pair<int,int>,int> mp;
    int n;cin>>n;
    for(int i=1;i<=n;i++){
        mp[{f(i),i%10}]++;
    }
    int cnt=0;
    for(int i=1;i<=n;i++){
        cnt+=mp[{i%10,f(i)}];
    }
    cout<<cnt;
}

Measured memory_bytes: 256
//sieu nhan
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inp "test.inp"
#define out "test.out"
#define oo 100005
#define inf 1e15
#define mod 1000000007
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define y1 hungdzno1
int n,a[oo][5],f[oo][5];
void nhap(){
  cin>>n;
  for(int i=1;i<=n;++i) for(int j=1;j<4;++j) cin>>a[i][j];
}
void xuly(){
  for(int i=1;i<=n;++i){
    f[i][1]=max(f[i-1][2],f[i-1][3])+a[i][1];
    f[i][2]=max(f[i-1][1],f[i-1][3])+a[i][2];
    f[i][3]=max(f[i-1][1],f[i-1][2])+a[i][3];
  }
  cout<<max(max(f[n][1],f[n][2]),f[n][3]);
}
main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  //freopen(inp,"r",stdin);
 // freopen(out,"w",stdout);
  nhap();
  xuly();
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define reps(i,s,n) for (int i = s; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
#define per(i,n) for (int i = n - 1; i >= 0; --i)
#define per1(i,n) for (int i = n; i >= 1; --i)
#define all(c) begin(c),end(c)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline T intceil(T a, T b) { return (a + (b - 1)) / b; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const long long MOD = 1e9+7;
#define precout() cout << std::fixed << std::setprecision(20);
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };
// if(nextY >= 0 && nextY < H && nextX >= 0 && nextX < W)
static const long double pi = acos(-1.0);
typedef complex<ld> cd;

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

    int N; cin >> N;
    vector<ll> A(N+1);
    rep(i, N+1) cin >> A[i];
    auto B = A;
    per(i, N) {
        B[i] += B[i+1];
    }

    ll ans = 0, cur = 1;

    rep(i, N+1) {
        if(cur < A[i]) {
            cout << -1 << endl;
            return 0;
        }

        ans += cur;
        cur -= A[i];
        cur *= 2LL;
        chmin(cur, B[i+1]);
    }

    cout << ans << endl;
}


Measured memory_bytes: 4744
N, K = map(int, input().split())
A = list(map(int, input().split()))
left, right = 0, max(A)
while right - left != 1:
    mid = (left + right) // 2
    tmp = 0
    for i in A:
        tmp += i // mid - 1 if i % mid == 0 else i // mid

    if tmp > K:
        left = mid
    else:
        right = mid

print(right)


Measured memory_bytes: 30868
N,M =map(int,input().rstrip().split(" "))
ans = [0 for _ in range(N + 3)]
ans[0] = 1
m = []
mc = 0
for _ in range(M):
  m.append(int(input()))
m.append(0)
for i in range(1,N + 1):
  if m[mc] != i:
    ans[i] += ans[i - 1]
    ans[i] += ans[i - 2]
    ans[i] %= 1000000007
  else:
    mc += 1
print(ans[N])


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

int main() {
    int n, m;
    cin >> n >> m;
    int sum = 0;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] * 4*m >= sum) ++cnt;
    }
    cout << (cnt >= m ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256