akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

bool solve(int n){
  long l=1;
  while(l*(l+1)/2 < n) l++;

  if(l*(l+1)/2 != n) return false;

  cout << "Yes" << endl;

  cout << l+1 << endl;

  vector<vector<int>> vv(l+1);

  int last = 0;
  rep(i,l+1){
    cout << l;
    rep(j,i) {
      cout << " " << vv[j][i-1];
      vv[i].pb(vv[j][i-1]);
    }
    rep(j,i,l){
      cout << " " << ++last;
      vv[i].pb(last);
    }
    cout << "\n";
  }


  return true;
}

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

  if(!solve(n)) cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 2304
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<vector>
#include<functional>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

int main()
{
	int a, b;
	cin >> a >> b;
	if (a*b % 2 == 0)cout << "Even" << endl;
	else cout << "Odd" << endl;
	return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  
  int sum=0;
  vector<int>vec(M);
  for(int i=0;i<M;i++){
    cin>>vec.at(i);
      sum+=vec.at(i);
  }
  
  if(N<sum){
    cout << -1 << endl;
  }
  
  else{
    cout << N-sum << endl;
  }
}

Measured memory_bytes: 3640
def c_candles():
    N, K = [int(i) for i in input().split()]
    X = [int(i) for i in input().split()]

    ans = float('inf')
    # 左から left 番目のろうそくから右へ連続した K 本のろうそくに火をつけるといい
    # 左端か右端か、近い方からつけ始める
    for left in range(N - K + 1):
        right = left + K - 1
        dist1, dist2 = min(abs(X[left]), abs(X[right])), abs(X[right] - X[left])
        ans = min(ans, dist1 + dist2)
    return ans

print(c_candles())

Measured memory_bytes: 14384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
  	cin >> n ;
  	int max = 0;
  	int sum = 0;
  	vector<int> data(n);
	for(int i = 0 ; i < n ; i++){
   		cin >> data.at(i) ; 	
      	sum += data.at(i);
      	if(data.at(i)>max){
        	max  =  data.at(i) ;
        }  
    }
    if(max<sum-max){
      	cout << "Yes" << endl;
    }
  	else{
      	cout << "No" << endl;
    }
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class DNotDivisible {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        const int MX = ten(6);
        int N;
        in>>N;
        vc<int> cnt(MX+1, 0);
        vc<bool> ok(MX+1, true);
        set<int> S;
        REP(i, N){
            int a;
            in>>a;
            cnt[a]++;
            S.insert(a);
        }
        int ans = 0;
        for(auto& s : S){
            if(cnt[s]==1 and ok[s]) ++ans;
            for(int j=2*s;j<=MX;j+=s){
                ok[j] = false;
            }
        }
        out<<ans<<'\n';
    }
};


int main() {
	DNotDivisible solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 16728
#include <stdio.h>
#define MAX 102 
int min(int a, int b){
  return (a <= b) ? a: b;
}
int main(void){
  int n,i,j,k,l,d[MAX],m[MAX][MAX];
  scanf("%d",&n);
  for(i = 1; i <= n; i++)scanf("%d %d",&d[i-1],&d[i]);
  for(i=1; i<n; i++)m[i][i] = 0;
  for(l=2; l<=n; l++){
    for(i=1; i<=n-l+1; i++){
      j = i+l-1;
      m[i][j] = 2000000000;
      for(k=i; k<j; k++)m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + d[i-1]*d[k]*d[j]);
    }
  }
  printf("%d\n",m[1][n]);
  return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 998244353;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> L(K), R(K);
  REP(i, K) { cin >> L[i] >> R[i]; }
  vector<int> Wa(N + 100);
  vector<int> dp(N+ 100);
  dp[1] = 1;
  Wa[1] = 1;
  for (int i = 1; i <= N; i++) {
    ll num = 0;

    REP(j, K) {
      int l = max(0, i - R[j] - 1);
      int r = i - L[j];
      if (r < 0) continue;
      dp[i] += Wa[r] - Wa[l];
      while (dp[i] < 0) {
        dp[i] += MOD;
      }
      dp[i] %= MOD;
    }
    Wa[i] = dp[i] + Wa[i - 1];
    while (Wa[i] < 0) {
      Wa[i] += MOD;
    }
    Wa[i] %= MOD;
  }
  cout << dp[N] << endl;
}


Measured memory_bytes: 4836
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define INF (1<<29)
int K[150];
int X[10][150];
int D[10][150];
int DP[10][150][80];
int main() {
	int N,M;
	while(scanf("%d %d",&N,&M),N|M) {
		for(int y=0;y<N;y++) {
			scanf("%d",&K[y]);
			for(int x=0;x<K[y];x++) {
				scanf("%d %d",&X[x][y],&D[x][y]);
			}
		}
		fill((int*)DP,(int*)(DP+10),INF);
		for(int x=0;x<K[0];x++) DP[x][0][M]=0;
		if(M>0) for(int x=0;x<K[1];x++) DP[x][1][M-1]=0;
		for(int y=1;y<N;y++) for(int x=0;x<K[y];x++) {
			for(int xx=0;xx<K[y-1];xx++) for(int m=0;m<=M;m++) {
				DP[x][y][m]=min(DP[x][y][m],DP[xx][y-1][m]+(D[x][y]+D[xx][y-1])*abs(X[x][y]-X[xx][y-1]));
			}
			if(y==1) continue;
			for(int xx=0;xx<K[y-2];xx++) for(int m=0;m<M;m++) {
				DP[x][y][m]=min(DP[x][y][m],DP[xx][y-2][m+1]+(D[x][y]+D[xx][y-2])*abs(X[x][y]-X[xx][y-2]));
			}
		}
		int ans=INF;
		for(int x=0;x<K[N-2];x++) for(int m=1;m<=M;m++) {
			ans=min(ans,DP[x][N-2][m]);
		}
		for(int x=0;x<K[N-1];x++) for(int m=0;m<=M;m++) {
			ans=min(ans,DP[x][N-1][m]);
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 1508
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define mkp make_pair
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
/*
ll bin(ll i,ll j){
	ll mid=(i+j)/2;
	if(a[mid]==x)reutrn mid;
	else if(ans>x)return bin(i,mid-1);
	else return bin(mid+1,j);
}/*
ll power(ll base,ll power){
    ll res=1;
    base=base%mod;
    while(power>0){
    	if(power&1){
    		res=(res*base)%mod;
		}
		power=power>>1;
		base=(base*base)%mod;
	}
	return res;
}
*/
/*
int nCr(int x, int y){
	if(y>x)return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=mod;
	num*=invfact[x-y];
	num%=mod;
	return num;
}
*/
/*bool prime[n+1];
void SieveOfEratosthenes(int n){
	rep(i,0,n+1)prime[i]=true
    for (int p=2;p*p<=n;p++)
        if (prime[p])
            for (int i=p*p;i<=n;i+=p)prime[i]=false;
}*/
/*
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
*/
int solve(){
	string s;
	cin>>s;
	if(s[3]==s[2]&&s[4]==s[5])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    ll N, K;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    sort(all(H));
    reverse(all(H));
    if(K >= N) output(0);
    else {
        ll sum = 0;
        rep(i, K, N) {
            sum += H[i];
        }
        output(sum);
    }
    
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector <ll>
#define vii vector <int>
#define vpii vector <pii>
#define vpll vector <pll>
#define ff first
#define ss second
#define matrix vector <vll>
#define all(v) v.begin(),v.end()
#define PQ priority_queue
#define sq(a) (a)*(a)
using namespace std;
bool is_int(vii a, vii b){
	int d = a.size();
	ll val = 0;
	for(int i = 0; i < d; i++){
		val+= sq(a[i] - b[i]);
	}
	ll  tmp = (ll) sqrt(val);
	return tmp*tmp == val;
}
int main()
{
	//ios::sync_with_stdio(0);
	//cin.tie(0);
	int n, d;
	cin >> n >> d;
	vector <vii> v(n, vii(d)); 
	for(int i = 0; i < n; i++){
		for(int j = 0; j < d; j++) cin >> v[i][j];
	}
	int cnt = 0;
	for(int i = 0; i < n-1; i++){
		for(int j = i+1; j < n; j++){
			if(is_int(v[i], v[j])) cnt++;
		}
	}
	cout << cnt << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>

typedef long long ll;

using namespace std;

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

int main()
{
    ll n,m,e,a,b,ans;
    string s,t;
    cin >> n >> m;
    cin >> s >> t;
    e = gcd(n,m);

    a = n/e;
    b = m/e;
    ans = a*b*e; //最小公倍数

    for(int i = 0;i < e;i++)
    {
        if(s[i*a] != t[i*b])
        {
            ans = -1;
            break;
        }
    }

    cout << ans << endl;

    return 0;

}



Measured memory_bytes: 512
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    
    for(int i = 0;n-7*i>=0;i++){
      if((n-7*i)%4 == 0){
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
}

Measured memory_bytes: 23764
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#include <unordered_map>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    sum /= 2;

    int x1 = sum;
    for (int i = 1; i < n; i += 2) {
        x1 -= a[i];
    }

    for (int i = 0; i < n; i++) {
        cout << x1 * 2 << " ";
        x1 = a[i] - x1;
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //int t;
    //cin >> t;
    int t = 1;
    while (t--) solve();
}

Measured memory_bytes: 2176
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl
#define printV(v) for(int zxc=0;zxc<v.size()-1;zxc++){cout << v[zxc] << " ";} cout << v.back() << endl;

typedef pair<int, int> t;

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

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

long roundup(long a, long b) {
    if (a % b == 0) return a / b;
    else return a / b + 1;
}

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    long lt, la;
    cin >> lt >> la;
    long t, a, c;
    FOR(i,1,n) {
        cin >> t >> a;
        c = max(roundup(lt, t), roundup(la, a));
        lt = t * c;
        la = a * c;
    }
    print(la + lt);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector <int> h(n);
  REP(i, n) {
	cin >> h[i];
  }
  vector <int> dp(n);
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);
  for (int i = 2; i < n; i++) {
	  dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	}
  cout << dp[n - 1] << endl;
  return 0;
}


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

// 記事を見ないとビット全探索が書けない…
int main() {
  int n, m;
  cin >> n >> m;

  vector<int> K(m);
  vector<vector<int> > S(m, vector<int>(10));
  rep(i, m) {
    int k;
    cin >> k;
    K[i] = k;
    rep(j, k) {
      int s;
      cin >> s;
      s--;
      S[i][j] = s;
    }
  }

  vector<int> P(m);
  for (int i = 0; i < m; i++) cin >> P[i];

  int ans = 0;
  // スイッチの付け方をビット全探索
  for (int bits = 0; bits < (1 << n); bits++) {
    bool ok = true;

    // 電球を全探索
    for (int i = 0; i < m; i++) {
      int tmp_sum = 0;
      for(int j = 0; j < K[i]; j++) {
        // int mask = bits >> S[i][j];
        // if (mask & 1) {  // i番目のbitが立っていれば加算する
         if (bits & (1 << S[i][j])) {
          tmp_sum++;
        }
      }
      if (tmp_sum % 2 != P[i]) ok = false;
    }
    if (ok) ans++;
  }

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


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

long long gcd(long long a, long long b) {
	if (b)
		return gcd(b, a%b);
	return a;
}
int main() {
	int n;
	cin>>n;
	long long ans;
	cin>>ans;
	for (int i=1; i<n; i++) {
		long long tmp;
		cin>>tmp;
		ans = gcd(ans, tmp);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
while True:

    H,W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for j in range(W):
            if i == 0 or i == H-1 or j == 0 or j == W-1:
                print("#", end = "")
            else:
                print(".", end = "")
        print()
    print()



Measured memory_bytes: 7004
#include <cstdio>
using namespace std;

int main (){
    int N;
    double ans=0.0;
    scanf("%d",&N);
    double a[N];
    for (int i = 0; i < N; i++){
        scanf("%lf",&a[i]);
        ans+=1.0/a[i];
    }
    ans=1/ans;
    printf("%lf",ans);
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

main()
{
        int n,m; cin>>n>>m;
        int l=1,r=n;
        rep(i,m)
        {
                int a,b; cin>>a>>b;
                l=max(l,a);
                r=min(r,b);
                if(l>r)
                {
                        cout<<0<<endl;
                        return 0;
                }
        }
        cout<<r-l+1<<endl;
}


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


def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1


def main():
    X = int(input())
    while True:
        if is_prime(X):
            break
        X += 1

    print(X)


if __name__ == '__main__':
    main()


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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;


vlli G[51];

lli dfs(vector<P> &res, lli cur, lli &count, lli from, vlli &low, vlli &pre) {
    pre[cur] = count;
    low[cur] = pre[cur];
    count++;

    REP(i,0,G[cur].size()) {
        lli to = G[cur][i];
        if (from == to) {
            continue;
        }

        if (pre[to] == -1) {
            low[cur] = min(low[cur], dfs(res, to, count, cur, low, pre));
            if (low[to] == pre[to]) {
                res.push_back(P(cur, to));
            }
        }
        else {
            low[cur] = min(low[cur], low[to]);
        }
    }

    return low[cur];
}

// n: number of nodes
void bridges(vector<P> &res, lli n) {
    vlli low(n+1, -1);
    vlli pre(n+1, -1);
    lli count = 0;
    dfs(res, 1, count, -1, low, pre);
}

int main() {
    lli n,m;
    cin2(n,m);
    REP(i,0,m) {
        lli a,b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<P> res;
    bridges(res, n);
    cout << res.size() << endl;
}


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

#define max 1000000

int arr[max];

int main(){
  
  int n; cin >> n;
  
  long long total = 0;
  
  for(int i=0;i<n;i++){
    int x; cin >> x;
    total += x;
    arr[x]++;
  }
  
  int m; cin >> m;
  
  while(m--){
    int a,b; cin >> a >> b;
    total -= (arr[a]*a);
    arr[b] += arr[a];
    total +=  arr[a] * b;
    arr[a] = 0;
    printf("%lli\n",total);

  }
  
    
  
  return 0;
}

Measured memory_bytes: 3564
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

int main(){
	while(true){
		int n, d;
		cin >> n >> d;
		
		if(n == 0){
			break;
		}
		
		vector<long long int> v[110];
		long long int S[110] = {};
		
		for(int i = 0; i < n; i++){
			int m;
			cin >> m;
			v[i].push_back(INF);
			for(int j = 0; j < m; j++){
				int num;
				cin >> num;
				v[i].push_back(num);
				S[i] += num;
			}
		}
		
		while(true){
			vector<P> vs;
			for(int i = 0; i < n; i++){
				vs.push_back(make_pair(S[i], i));
			}
			sort(vs.begin(), vs.end());
			bool flag = true;
			for(int i = 0; i < n; i++){
				int index = n - 1;
				if(i == vs[n - 1].second){
					index--;
				}
				if(vs[index].first - d <= S[i] - v[i][v[i].size() - 1]){
					S[i] -= v[i][v[i].size() - 1];
					v[i].pop_back();
					flag = false;
				}
			}
			if(flag){
				break;
			}
		}
		
		int SS = 0;
		for(int i = 0; i < n; i++){
			SS += v[i].size();
		}
		
		if(SS == n){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3264
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')

file=0



def solve():
    
    # for _ in range(ii()):
    h,w,k=mi()
    a=[]
    cnt=0
    for i in range(h):
        a.append(si())
        for j in a[i]:
            if j=='#':
                cnt+=1
    ans=0
    # print(cnt)
    for i in range(1<<(h+w)):
        c=set()
        x=[]
        y=[]
        for j in range(h):
            if (i>>j)&1:
                x.append(j)
                for k1 in range(w):
                    if a[j][k1]=='#':
                        c.add(tuple([j,k1]))
        for j in range(w):
            if (i>>(h+j))&1:
                for k1 in range(h):
                    if a[k1][j]=='#':
                        c.add(tuple([k1,j]))
        c1=cnt-len(c)
        if(c1==k):
            # print(c,i,x,y)
            ans+=1
        
    print(ans)



 









if __name__ =="__main__":

    if(file):

        if path.exists('input1.txt'):
            sys.stdin=open('input1.txt', 'r')
            sys.stdout=open('output1.txt','w')
        else:
            input=sys.stdin.readline
    solve()


Measured memory_bytes: 70028
def main():
    o, e = input(), input()
    len_o, len_e = len(o), len(e)
    ans = ""

    for i in range(len_e * 2):
        if i % 2 == 0:
            ans += o[i // 2]
        else:
            ans += e[i // 2]

    if len_o == len_e + 1:
        ans += o[-1]

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61952
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#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 LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 600000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000 大きいとワ―シャルフロイドでオーバーフローを起こす
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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



int main(void) {

	int n;
	bool flag = true;
	int counta = 0;

	cin >> n;
	vector<string> s(n);
	FOR(i, 0, n - 1) {
		cin >> s[i];
	}
	FOR(i, 0, n - 1) {
		if (s[i] == "A") {
			counta++;
		}
		else {
			counta--;
			if (counta < 0) {
				flag = false;
			}
		}
	}

	if (counta != 0) {
		flag = false;
	}

	if (flag) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> P(N);
    REP(i, N) cin >> P[i];

    // P[i:i+K] が元々昇順に並んでいるような i の個数を求める
    int length = 1, num = 0;
    REP(i, N-1){
        if(P[i] < P[i+1]){ 
            ++length;
            if(length == K) ++num;
        }else length = 1;
    }

    int ans = 1;
    // 連結成分の個数を求める
    set<int> s;
    REP(i, K) s.insert(P[i]);
    FOR(i, K, N){
        s.erase(P[i-K]);
        if(P[i-K] > *s.begin() or P[i] < *s.rbegin()) ++ans;
        s.insert(P[i]);
    }
    cout << ans-max(0, num-1) << endl;

    return 0;
}

Measured memory_bytes: 10368
import math

a, b, h, m = map(int, input().split())
theta1 = 2 * math.pi * (h + m / 60) / 12
theta2 = 2 * math.pi * m / 60
theta = abs(theta1 - theta2)
print(math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(theta)))


Measured memory_bytes: 62336
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll ncr(ll a, ll b)
{
  ll res=1;
  for(ll i=1;i<=b;i++)
  {
    res *= a-i+1;
    res /= i;
  }
  return res;
}
int main()
{
  ll n,m;
  cin>>m>>n;
  ll res=ncr(n,2) + ncr(m,2);
  cout<<res;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j;
    string s;
    char a,b;
    cin>>s;
    j=s.length()-2;
    for(i=0;i<s.length();i++)
    {
        a=s[0];
        b=s[s.length()-1];
    }
    cout<<a<<j<<b<<endl;
}


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

using namespace std;

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    long long int total = 0;
    vector<long long int> h(n, 0);
    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
        total += h[i];
    }
    long long int l = -1;
    long long int r = (total / b);
    auto check = [=](long long int count)
    {
        vector<long long int> temp = h;
        for(int i = 0; i < n; i++)
        {
            temp[i] -= count * b;
        }
        sort(temp.begin(), temp.end());
        reverse(temp.begin(), temp.end());
        for(int i = 0; i < n && count > 0; i++)
        {
            long long int num = temp[i] / (a - b);
            num = temp[i] % (a - b) != 0 ? num + 1 : num;
            if(num <= count)
            {
                temp[i] -= num * (a - b);
                count -= num;
            }else{
                temp[i] -= count * (a - b);
                count = 0;
            }
        }
        for(auto e : temp)
        {
            if(e > 0)
            {
                return false;
            }
        }
        return true;
    };
    while (r - l > 1)
    {
        long long int m = (l + r) / 2;
        if(check(m))
        {
            r = m;
        }else{
            l = m;
        }
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
using namespace std;
signed main()
{
  int h,w;
  while(1){
    cin>>h>>w;
    if(h==0 && w==0) break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cout<<"#";
      }
      cout<<"\n";
    }
    cout<<"\n";
  }
  return(0);
}



Measured memory_bytes: 3104
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

void solve(std::string S){
    if(S == "SSS"){
        cout<<0<<endl; return;
    }
    if(S == "SSR"){
        cout<<1<<endl; return;
    }
    if(S == "SRS"){
        cout<<1<<endl; return;
    }
    if(S == "SRR"){
        cout<<2<<endl; return;
    }
    if(S == "RSS"){
        cout<<1<<endl; return;
    }
    if(S == "RSR"){
        cout<<1<<endl; return;
    }
    if(S == "RRS"){
        cout<<2<<endl; return;
    }
    if(S == "RRR"){
        cout<<3<<endl; return;
    }
}
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define REP2(i,n) for(int i=0;i<(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP4(i,m,n,s) for(int i=m;(s>0 and i<(int)(n)) or (s<0 and i>(int)(n));i+=s)
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REPIT(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define PIS(x) printf("%d ",x)
#define PN() putchar('\n')
#define PRINTARR(a,b) for(int i=0;(a+i)!=(b);i++){cout << *(a+i) << " ";}PN();
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define MT make_tuple

typedef pair<int, int> PII;
typedef tuple<int, int, int> T3I;
typedef long long LL;
typedef unsigned long long ULL;

void RI() {}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d", &head);
    RI(tail...);
}
void RLL() {}
template<typename... T>
void RLL( LL& head, T&... tail ) {
    scanf("%lld", &head);
    RLL(tail...);
}
void print() {putchar('\n');}
template<typename T, typename... U>
void print(T head, U... tail) {
    cout << head << " ";
    print(tail...);
}

#define MAX_N 100005
int r[MAX_N];
int a[MAX_N], t[MAX_N];
int X;

T3I solve(int m, int ma, int M, int d, int i) {
    if(i % 2 == 0) {
        ma = min(ma + max(0, d - m), X);
        m = max(0, m - d);
        M = max(0, M - d);
    } else {
        m = min(X, m + d);
        M = min(X, M + d);
    }
    //print(i, ":", d, "->", m, ma, M);
    return MT(m, ma, M);
}

int main()
{
    int K, Q;
    RI(X, K);
    REP(i, K) {
        RI(r[i]);
    }
    r[K] = 1000000001;
    RI(Q);
    REP(i, Q) {
        RI(t[i], a[i]);
    }

    int q = 0;
    int rp = 0;
    int m = 0, ma = 0, M = X;
    REP(i, K+1) {
        while(q < Q and t[q] <= r[i]) {
            int d = t[q] - rp;
            int mq, maq, Mq;
            tie(mq, maq, Mq) = solve(m, ma, M, d, i);
            printf("%d\n", min(Mq, mq + max(0, a[q] - maq)));
            q++;
        }
        tie(m, ma, M) = solve(m, ma, M, r[i] - rp, i);
        rp = r[i];
    }
    return 0;
}


Measured memory_bytes: 2432
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    if len(S)==2:
        print(S)
    else:
        print(S[::-1])
if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#include<atcoder/dsu>

using namespace std;
using namespace atcoder;

int main() {
  int n, q;
  cin >> n >> q;
  dsu d(n);
  while (q--) {
    int t, u, v;
    cin >> t >> u >> v;
    if (t) 
      cout << d.same(u, v) << endl;
    else
      d.merge(u, v);
  }
}

Measured memory_bytes: 3836
#include <stdio.h>

int main(){
	
	int a, b, ans;
	scanf("%d %d", &a, &b);
	ans = (a/b);
	if(a%b == 0){
		printf("%d", ans);
	}
	else if(a <= b){
		printf("1");
	}
	else if(b == 1){
		printf("%d", a);
	}
	else{
		printf("%d", ans + 1); 
	}
		
	return 0;
}

Measured memory_bytes: 1728
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define INT_MAX 2147483647
#define LLINT_MAX 9223372036854775807
#define mod 1000000007
#define ll long long int
using namespace std;

int main() {
	int n;
	bool col;
	col = false;
	char s;
	cin >> n;
	lp(n) {
		cin >> s;
		if (s == 'Y')col = true;
	}
	if (col)cout << "Four" << endl;
	else cout << "Three" << endl;
	return 0;
}

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(abs(a - c) <= d) cout << "Yes" << endl;
  else if(abs(a - b) <= d && abs(b - c) <= d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstdlib>
#include<vector>
#include<algorithm>
#include<cassert>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(C) (C).begin(),(C).end()
#define fi first
#define se second

const int N = 10000;
struct Edge{
  int to,cost;
};
//solve connected graph
vector<int> edgeOnCycle;//only cost is enough
vector<int> edgeOnTree;//only cost is enough
int minEdgeOnCycle[2];//[0] < [1]
int minEdgeOnTree;
vector<Edge> edge[N];//
int dig[N];//for assertion

int vis[N];
bool dfs(int now,int color){
  if (vis[now])return vis[now] == color;
  vis[now]=color;
  bool oncycle=false;
  rep(i,(int)edge[now].size()){
    bool tmp=dfs(edge[now][i].to,color);
    if (tmp){
      oncycle=true;
      if (edge[now][i].cost < minEdgeOnCycle[0]){
	minEdgeOnCycle[1]=minEdgeOnCycle[0];
	minEdgeOnCycle[0]=edge[now][i].cost;
      }else if (edge[now][i].cost < minEdgeOnCycle[1]){
	minEdgeOnCycle[1]=edge[now][i].cost;
      }
    }else minEdgeOnTree=min(minEdgeOnTree,edge[now][i].cost);
  }
  return oncycle;
}

//find connect ?
vector<int> udedge[N];//undirect
void dfs2(int now){
  if (vis[now])return;
  vis[now]=true;
  rep(i,(int)udedge[now].size()){
    dfs2(udedge[now][i]);
  }
}

bool isconnected(int n){
  rep(i,n)vis[i]=0;
  dfs2(0);
  rep(i,n){
    if (vis[i]==0)return false;
  }
  return true;
}

int solve(int n){
  if (!isconnected(n))return 0;
  int color=1;
  rep(i,n)vis[i]=0;
  rep(i,n){
    if (vis[i] == 0)dfs(i,color),color++;
  }
  if (minEdgeOnCycle[0] == INT_MAX)return minEdgeOnTree;
  return min(minEdgeOnCycle[0]+minEdgeOnCycle[1],minEdgeOnTree);
}

main(){
  int n,m;
  while(cin>>n>>m && n){
    rep(i,n){
      udedge[i].clear();
      edge[i].clear();
      dig[i]=0;
    }
    edgeOnCycle.clear();
    edgeOnTree.clear();
    minEdgeOnCycle[0]=INT_MAX;
    minEdgeOnCycle[1]=INT_MAX;
    minEdgeOnTree=INT_MAX;
    int ans=0;
    rep(i,m){
      int f,t,c;
      cin>>f>>t>>c;
      dig[t]++;
      if (c <= 0){//elminate negative edge (also negative seledge)
	ans+=c;//c<0
      }else if (f == t){//ignore self edge of positive cost
      }else {
	edge[f].push_back((Edge){t,c});
	udedge[f].push_back(t);
	udedge[t].push_back(f);
      }
    }
    rep(i,n)if (dig[i] >1)assert(false);

    int sum=solve(n);
    cout << ans+sum << endl;
  }
  return false;
}

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

int main() {
    long long n,k;
    cin>>n>>k;
    long long newN = abs(n-k);
    long long diff = n - newN;
    
    if(diff < 0) {
        cout << n << endl;
        return 0;
    }
    if(newN == 0) {
        cout << 0 << endl;
        return 0;
    }
    if(n == 0) {
        cout << 0 << endl;
        return 0;
    }
    if(n%k == 0) {
        cout << 0 << endl;
    }
    else{
        if(abs((n%diff) - k) < abs(n%diff)) {
            cout << abs(k-(n%diff)) << endl;
            return 0;
        }
        else{
            cout << n%diff << endl;
            return 0;
        }

    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define inputv(v, n)                                                           \
    vl v;                                                                      \
    rep(i, n) {                                                                \
        ll x;                                                                  \
        cin >> x;                                                              \
        v.push_back(x);                                                        \
    }
bool chmin(ll& a, ll& b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll& a, ll& b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
vl A, B;
struct Gragh {
    ll N;
    vector<vl> G;
    vl visited;

    Gragh(ll n) {
        N = n;
        G.resize(N);
        resetv();
    }

    void add(ll a, ll b) { G[a].push_back(b); }

    void resetv(void) { visited = vl(N, 0); }

    //重さ無し
    void dfs1(ll x) {
        visited[x] = 1;
        for (ll i : G[x]) {
            if (visited[i] == 0) {
                dfs1(i);
                A.push_back(i);
                break;
            }
        }
    }

    //重さ無し
    void dfs2(ll x) {
        visited[x] = 1;
        for (ll i : G[x]) {
            if (visited[i] == 0) {
                dfs2(i);
                B.push_back(i);
                break;
            }
        }
    }
};
int main() {
    cin >> n >> m;
    Gragh G(n);
    rep(i, m) {
        cin >> a >> b;
        a--;
        b--;
        G.add(a, b);
        G.add(b, a);
    }

    G.dfs1(0);
    G.dfs2(0);
    reverse(all(B));
    cout << A.size() + B.size() + 1 << endl;
    rep(i, A.size()) {
        cout << A[i] + 1 << " ";
    }
    cout << 1 << " ";
    rep(i, B.size()) {
        cout << B[i] + 1 << " ";
    }

}


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

    int count = 0;
    bool check;
    for(int i=a; i <= b; i++){
        string str = to_string(i);
        int len = str.length() - 1;
        check = true;
        rep(j, 2){
            if(str[j] != str[len--]){
                check = false;
                break;
            }
        }
        if(check){
            count++;
        }
    }
    cout << count << endl;

    return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<bool>a(1e9+1,false);
	for(int i=0;i<n;++i){
		int A; cin>>A;
		a.at(A)=!a.at(A);
	}
	cout<<count(a.begin(),a.end(),true)<<"\n"s;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep1c(i, n) for (int i = 1; i <= (int)(n); i++)
#define repc0(n, i) for (int i = (int)(n); i >= 0; i--)

using namespace std;
typedef long long ll;

struct DisjointSet {
  map<int, int> parent, rank, num;

  void makeSet(int x) {
    parent[x] = x;
    rank[x] = 0;
    num[x] = 1;
  }

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

  void unite(int x, int y) {
    link(findSet(x), findSet(y));
  }

  void link(int x, int y) {
    if(rank[x] < rank[y]) {
      parent[x] = y;
      num[y] += num[x];
    } else {
      parent[y] = x;
      num[x] += num[y];
      if(rank[x] == rank[y]) rank[x]++;
    }
  }

  int numberOf(int x) {
    return num[findSet(x)];
  }

  int findSet(int x) {
    if(x == parent[x]) return x;
    else return parent[x] = findSet(parent[x]);
  }
};

static const int MAX=100010;
ll N, M, A[MAX], B[MAX];
DisjointSet ds;

void solve() {
  ll current = N*(N-1)/2;
  ll res[M];
  repc0(M-1, i) {
    res[i] = current;
    if(!ds.same(A[i], B[i])) {
      current -= ds.numberOf(A[i]) * ds.numberOf(B[i]);
      ds.unite(A[i], B[i]);
    }
  }
  rep(i, M) printf("%lld\n", res[i]);
}

int main() {
  scanf("%d %d", &N, &M);
  rep(i, N) ds.makeSet(i);
  rep(i, M) {
    scanf("%d %d", &A[i], &B[i]);
    A[i]--;
    B[i]--;
  }
  solve();
  return 0;
}


Measured memory_bytes: 17664
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> V;

int dp[10005];

int main() {
  int n, w;
  cin >> n >> w;
  V vn(n), vw(n);
  REP(i, n) {
    cin >> vn[i] >> vw[i];
  }
  REP(i, n) {
    for (int j = w; j >= vw[i]; j--) {
      dp[j] = max(dp[j-vw[i]]+vn[i], dp[j]);
    }
  }
  dump(dp[w]);
  return 0;
}



Measured memory_bytes: 3100
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <deque>
using ll = long long;
using namespace std;

int main(){
    string s;
    cin >> s;
    s[5] = ' '; s[13] = ' ';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
#include <iostream>

struct Node{
    int key;
    Node *prev, *next;
};

Node *nil;

void Init(){
    nil = (Node *)malloc(sizeof(Node));
    nil -> prev = nil;
    nil -> next = nil;
    return;
}

void Insert(int insert_key){
    // 挿入するノード宣言してキーの値を入れる
    Node *x = (Node *)malloc(sizeof(Node));
    x -> key = insert_key;
    
    // 番兵の直後に要素を追加
    x -> next = nil -> next;
    nil -> next -> prev = x;
    x -> prev = nil;
    nil -> next = x;
    return;
}

Node* Search(int search_key){
    Node *current = nil -> next;
    while(current != nil && current -> key != search_key){
        current = current -> next;
    }
    return current; 
}

void Delete(Node *x){
    if(x == nil){return;}
    x -> prev -> next = x -> next;
    x -> next -> prev = x -> prev;
    free(x);
    return;
}

void DeleteFirtst(){
    Delete(nil -> next);
    return;
}

void DeleteLast(){
    Delete(nil -> prev);
    return;
}

void Output(){
    Node *x = nil -> next;
    while(x != nil){
        printf("%d", x -> key);
        if(x -> next != nil){printf(" ");}
        else{printf("\n");}
        x = x -> next;
    }
    return;
}

int main(void){
    Init();
    int n;
    scanf("%d", &n);
    char command[12];
    int key;
    for(int i=0; i<n; i++){
        scanf("%s%d", command, &key);
        if(!strcmp(command, "insert")){Insert(key);}
        else if(!strcmp(command, "delete")){Delete(Search(key));}
        else if(!strcmp(command, "deleteFirst")){DeleteFirtst();}
        else {DeleteLast();}
    }
    Output();
    return 0;
}


Measured memory_bytes: 34408
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

ll factorial(ll n){
  if(n==1) return 1;
  else return n*factorial(n-1)%1000000007;
}

int main()
{
  ll n,m;
  cin>>n>>m;

  if(abs(n-m)>1){
    cout<<0<<endl;
    return 0;
  }

  cout<<((n==m)? 2:1)*factorial(n)*factorial(m)%(1000000007)<<endl;
  
  return 0;
}

Measured memory_bytes: 1792
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <iostream>
#include <limits>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
typedef stringstream ss;
const int mii = numeric_limits<int>::min();
const int mai = numeric_limits<int>::max();
const ll mil = numeric_limits<long long>::min();
const ll mal = numeric_limits<long long>::max();

#define REP(i, a, b) for(int i=a; i<=b; ++i)
#define RREP(i, a, b) for(int i=a; i>=b; --i)
#define PB(x) push_back(x)

int main(int argc, char **argv) {
    string s;

    cin >> s;

    if(s[2] == s[3] && s[4] == s[5])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
using namespace std;


int main(){
	ll a, b, c, d, e; cin >> a >> b >> c >> d >> e;
	ll aa = a % 10 > 0 ? a % 10 : 10;
	ll bb = b % 10 > 0 ? b % 10 : 10;
	ll cc = c % 10 > 0 ? c % 10 : 10;
	ll dd = d % 10 > 0 ? d % 10 : 10;
	ll ee = e % 10 > 0 ? e % 10 : 10;
	ll mini = min({ aa, bb, cc, dd, ee });

	ll ans = a + (10 - aa) + b + (10 - bb) + c + (10 - cc) + d + (10 - dd) + e + (10 - ee) - 10 + mini;
	cout << ans << endl;
	return 0;
}

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

int main(){

  int num;
  while(cin >> num){
    int combi = 0;
    for(int i = 0; i  <=9; i++){
      for(int j = 0; j <= 9; j++){
	for(int k = 0; k <= 9; k++){
	  for(int l = 0; l <= 9; l++){
	    if(i+j+k+l == num){
	      combi++;
	    }
	  }
	}
      }
    }
    cout << combi << endl;
  }


 return 0;

}

Measured memory_bytes: 2964