akhauriyash/Code-Regression huggingface dataset:
//#include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<list>
using namespace std;

typedef long long ll;

#define MOD 1000000007

class Comb{
private:
  ll *fac,*finv,*inv;
public:
  Comb(){
    fac = new ll[1000000];
    finv = new ll[1000000];
    inv = new ll[1000000];
    fac[0] = 1;
    for(int i=1;i<1000000;i++){
      fac[i] = i*fac[i-1];
      fac[i] %= MOD;
    }
    inv[1] = 1;
    for(int i=2;i<1000000;i++){
      inv[i] = MOD-inv[MOD%i]*(MOD/i)%MOD;
    }
    finv[0] = 1;
    for(int i=1;i<1000000;i++){
      finv[i] = inv[i]*finv[i-1];
      finv[i] %= MOD;
    }
  }
  ll calc(ll n,ll k){
    ll c = fac[n];
    c *= finv[k];c %= MOD;
    c *= finv[n-k];c %= MOD;
    return c;
  }
};

int main(){
  string n;
  cin >> n;
  if(n[0] == '7' || n[1] == '7' || n[2] == '7') cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

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

    if(a>b){
        cout<<"GREATER"<<endl;
    }
    else if (a==b) {
        cout<<"EQUAL"<<endl;
    }
    else {
        cout<<"LESS"<<endl;
    }

}


Measured memory_bytes: 256
main=getLine>>=putStrLn.f
 where f s = g 0 0 0 (read[s!!0]) (read[s!!1]) (read[s!!2]) (read[s!!3])
       g i j k a b c d | a+(-1)^i*b+(-1)^j*c+(-1)^k*d==7 = (show a)++(h i)++(show b)++(h j)++(show c)++(h k)++(show d)++"=7"
                       | k==0 = g i j 1 a b c d
                       | j==0 = g i 1 0 a b c d
                       | i==0 = g 1 0 0 a b c d
       h n = if n==0 then"+"else"-"

Measured memory_bytes: 508
#include<iostream>
#include <string.h>
#include<stdio.h>
#include <math.h>


using namespace std;

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L]; //charの配列を二次元にすることで文字列を格納できる

//文字列から数値に変換
int getChar(char ch) {
	if (ch == 'A') return 1;
	else if (ch == 'C') return 2;
	else if (ch == 'G') return 3;
	else if (ch == 'T') return 4;
	else return 0;
}


//文字列から数値へ変換してkeyを生成する
long long getKey(char str[]) {
	long long sum = 0, p = 1, i;
	for (i = 0; i < strlen(str); i++) {
		sum += p * (getChar(str[i]));
		p *= 5;//pを掛け算することで何桁目が何の数か区別することができるようになる
	}
	return sum;
}

int h1(int key) { return key % M; }
int h2(int key) { return 1 + (key % (M - 1)); }

int find(char str[]) {
	long long key, i, h;
	key = getKey(str); //文字列を数値に変換
	for (i = 0;; i++) {
		h = (h1(key) + i * h2(key)) % M;
		if (strcmp(H[h], str) == 0) return 1;
		else if (strlen(H[h]) == 0) return 0;
	}
	return 0;
}


int insert(char str[]) {
	long long key, i, h;
	key = getKey(str); //文字列を数値に変換
	for (i = 0;; i++) {
		h = (h1(key) + i * h2(key)) % M;
		if (strcmp(H[h], str) == 0) return 1;
		else if (strlen(H[h]) == 0) {
			strcpy(H[h], str);//コンパイラによってはstrcpy_sに変更
			return 0;
		}
	}

}

int main() {
	int i, n, h;
	char str[L], com[9];
	for (i = 0; i < M; i++) H[i][0] = '\0';

	cin >> n;

	for (i = 0; i < n; i++) {
		cin >> com >> str;//charでもstringのように入力させられる

		if (com[0] == 'i') {
			insert(str);
		}
		else {
			if (find(str)) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}

	return 0;
}










Measured memory_bytes: 17372
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>

// template {{{
using namespace std;

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))

using int64 = long long;

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

bool in_field(int W, int H, int x, int y) {
  return (0 <= x && x < W) && (0 <= y && y < H);
}

// pair
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) {
  return s << "(" << p.first << ", " << p.second << ")";
}
// vector
template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << "\t";
  }
  return s;
}

// }}}

// url: https://atcoder.jp/contests/abc054/tasks/abc054_c

int N, M, a[8 * 7 / 2], b[8 * 7 / 2];
int n[8];

int main() {
  cin >> N >> M;
  rep(i, M) {
    int ta, tb;
    cin >> ta >> tb;
    a[i] = ta - 1;
    b[i] = tb - 1;
  }

  rep(i, N) n[i] = i;

  int ans = 0;

  do {
    // for (int i = 0; i < N; i++) {
    //   cout << n[i];
    //   if (i != N - 1)
    //     cout << " ";
    // }
    // cout << endl;

    int step = 0;
    rep(i, N - 1) rep(j, M) {
      if ((a[j] == n[i] && b[j] == n[i + 1]) ||
          (b[j] == n[i] && a[j] == n[i + 1])) {
        step++;
      }
    }
    // cout << step << endl;
    if (step == N - 1)
      ans++;
  } while (next_permutation(n + 1, n + N));
  cout << ans << endl;
  return 0;
}

// vim: foldmethod=marker


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <assert.h>
#include <memory.h>
#include <queue>
#include <string.h>
using namespace std;

#define N 303

int H[N];
long long dp[N][N];
void solve() {
  int n,k; scanf("%d %d",&n,&k);
  const long long inf = 2e18;
  for(int i=1;i<=n;++i) scanf("%d",&H[i]);
  for(int i=1;i<=n+1;++i) {
    for(int j=0;j<=k;++j) dp[i][j] = inf;
  }
  dp[0][0] = 0;
  for(int i=0;i<=n;++i) {
    for(int j=0;j<=k;++j) {
      for(int x=i+1;x<=n+1 && j + x-i-1<=k;++x) {
        int add = max(0,H[x]-H[i]);
        dp[x][j + x-i-1] = min(dp[x][j + x-i-1], dp[i][j] + max(0, H[x]-H[i]));
      }
    }
  }
  long long ret = dp[n+1][k];
  printf("%lld\n", ret);
}

int main() {
  //freopen("input.txt","r",stdin);
  solve();
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()

int main() {
	double a, b, n;
	cin >> a >> b >> n;
	if (n < b) {
		cout << (int)(n * a / b) << endl;
		return 0;
	}
	else {
		cout << (int)((b - 1) * a / b) << endl;
	}
}


Measured memory_bytes: 3196
#include <stdio.h>

int main(void){
  char n[200010];
  scanf("%s",n);
  int len=strlen(n);
  int sum = 0;

    for(int i=0;i<len;i++)sum+=n[i]-'0';
    if (sum %9 == 0){
      printf("Yes");
    }
    else{
      printf("No");
    }
    return 0;
}


Measured memory_bytes: 1928
#include <iostream>

using namespace std;

int main() {
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    int d1=abs(a1-a2)+abs(a2-a3);
    int d2=abs(a1-a3)+abs(a3-a2);
    int d3=abs(a3-a1)+abs(a1-a2);
    cout << min(d1, min(d2, d3)) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m,k;cin>>n>>k;
	int s = 1;
	rep(i, n){
		if(s < k){
			s*=2;
		}else{
			s+=k;
		}
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#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;
  cin >> n;
  string s;
  cin >> s;
  int res = 0;
  for (int x = 0; x <= 999; x++) {
    ostringstream sout;
    sout << setfill('0') << setw(3) << x;
    string xx = sout.str();
    for (int i = 0; i < n; i++) {
      if (s.at(i) != xx.at(0)) {
        continue;
      }
      for (int j = i + 1; j < n; j++) {
        if (s.at(j) != xx.at(1)) {
          continue;
        }
        for (int k = j + 1; k < n; k++) {
          if (s.at(k) == xx.at(2)) {
            res++;
            break;
          }
        }
        break;
      }
      break;
    }
  }
  cout << res << endl;
  return 0;
}


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

#define vi vector<int>
#define vl vector<long long>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define vp vector<P>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
#define INFTY 1e9
const int mod = 998244353;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

template<class T> bool chmax(T &a, const T & b) {
    if (a<b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> bool chmin(T &a, const T & b) {
    if (a>b) {
        a = b;
        return true;
    }
    return false;
}

//cout << fixed << setprecision(10) << y << endl;
struct edge {int to, cost;};
vector< vector<edge> > es;
const int MAX_N = 10010;

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

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

int main() {
    int n, m;
    cin >> n >> m;
    vl a(n);
    REP(i, n) cin >> a[i];
    int res = 0;
    ll l = 1;
    bool flag = true;
    int b = a[0];
    int cnt = 0;
    while (b % 2 == 0) {
        b /= 2;
        cnt += 1;
    }
    REP(i, n) {
        int c = 0;
        int num = a[i];
        while (num % 2 == 0) {
            num /= 2;
            c += 1;
        }
        if (cnt != c) {
            flag = false;
            break;
        }
    }
    REP(i, n) {
        a[i] /= 2;
        l = lcm(l, a[i]);
        if (l > m) {
            flag = false;
            break;
        }
    }

    if (flag) {
        res = (m/l+1)/2;
        cout << res << endl;
    } else {
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <atcoder/all>
#define ll long long int
#define vec vector<ll>
#define mat vector<vector<ll>>

using namespace std;
using namespace atcoder;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

int main(){

  ll n,q;
  cin >> n >>q;
  vec a(n);
  for(ll i=0;i<n;i++)cin >> a[i];

  fenwick_tree<ll> T(n);
  for(ll i=0;i<n;i++)T.add(i,a[i]);
  
  for(ll i=0;i<q;i++){
    ll c,p,x;
    cin >> c >> p >> x;
    if(c==0)T.add(p,x);
    else cout << T.sum(p,x) << endl;
  }

}

Measured memory_bytes: 12132
a1, a2 = map(int, input().split())
a3, a4 = map(int, input().split())
a5, a6 = map(int, input().split())

ans = []

ans.append(a1)
ans.append(a2)
ans.append(a3)
ans.append(a4)
ans.append(a5)
ans.append(a6)

max = 0

for i in ans:
	if max < ans.count(i):
		max = ans.count(i)

print("YES" if max <= 2 else "NO")

Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  int m; cin >> m;
  while(m--) {
    string s; cin >> s;
    set<string> cnt;
    FOR(i,1,s.length()) {
      string fr = s.substr(0, i);
      string bc = s.substr(i, s.length() - i);
      string re_fr = fr;
      string re_bc = bc;
      reverse(re_fr.begin(), re_fr.end());
      reverse(re_bc.begin(), re_bc.end());
      cnt.insert(fr + bc);
      cnt.insert(fr + re_bc);
      cnt.insert(re_fr + bc);
      cnt.insert(re_fr + re_bc);
      cnt.insert(bc + fr);
      cnt.insert(bc + re_fr);
      cnt.insert(re_bc + fr);
      cnt.insert(re_bc + re_fr);
    }
    cout << cnt.size() << endl;
  }
  return 0;
}

Measured memory_bytes: 3240
s=input()
a=len(s)
cnt=0
l=0
r=1
W='aaa'
while r<a+1:
  if s[l:r]!=W:
    cnt+=1
    W=s[r-1:r]
    r+=1
    l=r-1
  else:
    cnt+=1
    W=s[r-1:r+1]
    r+=2
    l=r-1
if r!=a+1:
  cnt-=1
print(cnt)

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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	bool flag1 = true;
	if (N < 2){
		flag1 = false;
	}

	bool flag2 = true;
	if (M < 2){
		flag2 = false;
	}

	int cnt1 = 0;
	int cnt2 = 0;
	if (flag1){
		cnt1 = N*(N-1)/2;
	}
	if (flag2){
		cnt2 = M*(M-1)/2;
	}

	cout << cnt1 + cnt2 << "\n";

	return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int n;
    cin >> n;
    string s;
    set<string> st;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
}

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

int main()
{
    int h,w,n;
    cin >> h >> w >> n;
    if(h>w)
    {
        cout << (n%h==0?n/h:n/h+1) << endl;
    }
    else
    {
        cout << (n%w==0?n/w:n/w+1) << endl;
    }
    return 0;
}


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

using namespace std;

void CountryRoad(){
    int n,k,result;
    int x[100000],y[100000];
    cin >>n >>k;
    for(int i = 0; i<n; i++){
        cin >> x[i];
    }
    if(n <= k){
        cout << 0 << endl;
        return;
    }
    result = x[n-1]-x[0];
    if(k == 0){
        cout << result << endl;
        return;
    }
    for(int i = 0;i<n-1;i++){
        y[i] = x[i+1] - x[i];
    }
    sort(y,y+n-1);
    reverse(y,y+n-1);
    for(int i = 0; i<k-1; i++){
        result-=y[i];
    }
    cout << result << endl;
    return;
}

int main(){
    int loop;
    cin >> loop;
    while(loop != 0){
        CountryRoad();
        loop -= 1;
    }
}


Measured memory_bytes: 3936
#include <algorithm>  // sort, 二分探索(lower_bound)など
#include <cmath>      // pow, logなど
#include <complex>    // 複素数
#include <deque>      // 両端アクセスのキュー
#include <iostream>   // 入出力
#include <iterator>
#include <map>
#include <numeric>  // iota(整数列の生成), gcd, lcm
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>  // 順序保持しないmap
#include <unordered_set>  // 順序保持しないset
#include <utility>        // pair
#include <vector>

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, a, b) for (int i = (a); i >= (b); i--)
#define ALL(container) (container).begin(), (container).end()
#define MAX(x) *max_element(ALL(x))  // 最大値を求める
#define MIN(x) *min_element(ALL(x))  // 最小値を求める

using namespace std;
typedef long long ll;

constexpr int INF = 1e9;
constexpr int MOD = 1000000007;

int main() {
  size_t a, b, c, k;
  int sum = 0;
  cin >> a >> b >> c >> k;
  for (size_t i = 0; i < k; ++i) {
    if (a > 0) {
      a--;
      sum++;
    } else if (b > 0) {
      b--;
      continue;
    } else {
      c--;
      sum--;
    }
  }
  cout << sum << endl;
  return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s, t; cin >> s >> t;
    vector<int> prefs((int)s.length() + 1, 0);
    for (int i = 1; i <= (int)s.length(); i++) prefs[i] = prefs[i - 1] + (s[i - 1] == 'A' ? 1 : 2);
    vector<int> preft((int)t.length() + 1, 0);
    for (int i = 1; i <= (int)t.length(); i++) preft[i] = preft[i - 1] + (t[i - 1] == 'A' ? 1 : 2);
    int q; cin >> q;
    while (q--) {
        int a, b, c, d; cin >> a >> b >> c >> d;
        cout << ((prefs[b] - prefs[a - 1]) % 3 == (preft[d] - preft[c - 1]) % 3 ? "YES" : "NO") << '\n';
    }
    return 0;
}

Measured memory_bytes: 1744
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<algorithm>
using namespace std;

#define INF 1e30
#define EPS 1e-4
#define EQ(a,b) (fabs((a)-(b))<EPS)

int id[15],dist[15];
int num[1<<15];
double dp[1<<15][15];


int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>id[i]>>dist[i]>>num[1<<i];
	}
	for(int i=1;i<(1<<n);i++){
		int s=0;
		for(int j=0;j<n;j++)
			if(i>>j&1)s+=num[1<<j];
		num[i]=s;
	}
	for(int i=0;i<(1<<n);i++)
		for(int j=0;j<n;j++)dp[i][j]=INF;
	for(int i=0;i<n;i++)dp[1<<i][i]=0;
	for(int i=1;i<(1<<n)-1;i++){
		for(int j=0;j<n;j++){
			if(!(i>>j&1))continue;
			for(int k=0;k<n;k++){
				if(i>>k&1)continue;
				int d=abs(dist[j]-dist[k]);
				double sp=2000/(70.0+20*num[i]);
				dp[i|1<<k][k]=min(dp[i|1<<k][k], dp[i][j]+d/sp);
			}
		}
	}
	double t=INF;
	int v=-1;
	for(int i=0;i<n;i++){
		if(dp[(1<<n)-1][i]<t){
			t=dp[(1<<n)-1][i];
			v=i;
		}
	}
	vector<int> ans;
	int s=(1<<n)-1;
	ans.push_back(id[v]);
	while(dp[s][v]!=0){
		for(int i=0;i<n;i++){
			if(!(s>>i&1))continue;
			int d=abs(dist[i]-dist[v]);
			double sp=2000/(70.0+20*num[s&~(1<<v)]);
			if(EQ(dp[s][v],dp[s&~(1<<v)][i]+d/sp)){
				s&=~(1<<v);
				v=i;
				break;
			}
		}
		ans.push_back(id[v]);
	}
	reverse(ans.begin(),ans.end());
	cout<<ans[0];
	for(int i=1;i<ans.size();i++)cout<<' '<<ans[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 5184
function Main(input) {
  input = input.split("\n");
  var d = parseInt(input[0].split(" ")[0]);
  var g = parseInt(input[0].split(" ")[1]);
  p = new Array(d).fill(0);
  c = new Array(d).fill(0);

  for(i=0;i<d;i++){
    p[i]=parseInt(input[i+1].split(" ")[0]);
    c[i]=parseInt(input[i+1].split(" ")[1]);
  }
  a = new Array(d).fill(0);
  for(i=0;i<d;i++){
    a[i]=((i+1)*100)*p[i]+c[i];
  }
  var min = 10000000;
  m = new Array(d).fill(0);
  function f(a, min, d, d2,x,n,m,i2){
    for(i2=0;i2<2;i2++){
      var o2 = x;
      x += a[d2-1]*(i2);
      var o = n;
      n += p[d2-1]*(i2);
      m[d-d2] = 2*(i2);
      if(d2>=d){
        if(x<=g&&Math.ceil((g-x)/((d-m.indexOf(0))*100))<=p[d-m.indexOf(0)-1]){
          n += Math.ceil((g-x)/((d-m.indexOf(0))*100));
        }else if(x>=g){
          n= n;
        }else{
          n = 10000000;
        }
        min = Math.min(min,n);
        n=o;
        x=o2;
      }else{
        min=f(a,min,d,d2+1,x,n,m,i2);
      }
    }
    return min;
  }
  for(i1=0;i1<2;i1++){
    var x=0;
    var n=0;
    x += a[0]*(i1);
    n += p[0]*(i1);
    m[d-1] = 1*(i1);
    if(d<2){
      if(x<=g){
        n += Math.ceil((g-x)/((d-m.indexOf(0))*100));
      }
      min = Math.min(min,n);
    }else{
      min=f(a,min,d,2,x,n,m,0);
    }
  }
  console.log('%s', min);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
n=int(input())
a=list(map(int,input().split()))
i=0
l=0
while True:
    if i>n-1:break
    j=i
    while j<n-1 and a[j+1]==a[j]:
        j+=1
    l+=(j-i+1)//2
    i=j+1
print(l)

Measured memory_bytes: 2940
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;



public class Main{
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}



	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}


	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}


	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}


	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 long N=sc.nextLong();
	 long result =N*(N-1)/2;
 
	 System.out.println(result);
	 
	 
	
	 
	 
	 
 }
	


}



Measured memory_bytes: 22608
import java.io.*;
import java.nio.CharBuffer;
import java.util.NoSuchElementException;

public class Main {

    public static void main(String[] args) {
        SimpleScanner scanner = new SimpleScanner(System.in);
        PrintWriter writer = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        writer.println(Math.max(0, c - (a - b)));
        writer.close();
    }

    private static class SimpleScanner {

        private static final int BUFFER_SIZE = 10240;

        private Readable in;
        private CharBuffer buffer;
        private boolean eof;

        SimpleScanner(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
            buffer = CharBuffer.allocate(BUFFER_SIZE);
            buffer.limit(0);
            eof = false;
        }


        private char read() {
            if (!buffer.hasRemaining()) {
                buffer.clear();
                int n;
                try {
                    n = in.read(buffer);
                } catch (IOException e) {
                    n = -1;
                }
                if (n <= 0) {
                    eof = true;
                    return '\0';
                }
                buffer.flip();
            }
            return buffer.get();
        }

        void checkEof() {
            if (eof)
                throw new NoSuchElementException();
        }

        char nextChar() {
            checkEof();
            char b = read();
            checkEof();
            return b;
        }

        String next() {
            char b;
            do {
                b = read();
                checkEof();
            } while (Character.isWhitespace(b));
            StringBuilder sb = new StringBuilder();
            do {
                sb.append(b);
                b = read();
            } while (!eof && !Character.isWhitespace(b));
            return sb.toString();
        }

        int nextInt() {
            return Integer.valueOf(next());
        }

        long nextLong() {
            return Long.valueOf(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 22484
#include <bits/stdc++.h>
#define int long long

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int ans = LLONG_MIN;
	int a, b , c, d; cin >> a >> b >> c >> d;

	vector<int> v = {a, b, c, d};

	for(int i = 0 ; i < 2; i++){
		for( int j = 2; j < 4; j++){
			if( i == j) continue;
			else{
				ans = max(ans, v[i]*v[j]);
			}
		}
	}

	cout << ans;
   


	#ifdef LOCAL
	cerr << "\n";
	#endif
	return 0;
}


Measured memory_bytes: 3652
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int H, W, N;
	int result = 0;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		this.H = Integer.parseInt(in.readLine());
		this.W = Integer.parseInt(in.readLine());
		this.N = Integer.parseInt(in.readLine());
	}

	void calc() {
		int row = Math.max(H, W);
		result = N / row;
		if (N % row != 0) {
			result++;
		}
	}

	void showResult() {
		System.out.println(result);
	}
}


Measured memory_bytes: 21204
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] c1 = sc.next().split("");
        String[] c2 = sc.next().split("");
        String[] c3 = sc.next().split("");

        System.out.println(c1[0] + c2[1] + c3[2]);
    }

}


Measured memory_bytes: 21716
#include <iostream>

using namespace std;

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

	int result = -1;
	for(int i = 1; i <= N; i++) {
		const int X = i * 1.08;
		if(X == N) {
			result = i;
			break;
		}
	}

	if(result == -1) {
		cout << ":(" << endl;
	} else {
		cout << result << endl;
	}

	return 0;
}


Measured memory_bytes: 256
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let h: usize = itr.next().unwrap().parse().unwrap();
    let w: usize = itr.next().unwrap().parse().unwrap();
    let k: usize = itr.next().unwrap().parse().unwrap();
    let d: Vec<Vec<char>> = (0..h)
        .map(|_| itr.next().unwrap().chars().collect())
        .collect();

    let mut ans = 1 << 30;
    for bit in 0..(1 << h - 1) {
        let mut count = 0;
        let mut memo = vec![0; h + 1];
        let mut good = false;
        for j in 0..w {
            let mut now = 0;
            let mut tmp = vec![0; h + 1];
            for i in 0..h {
                if d[i][j] == '1' {
                    tmp[now] += 1;
                }
                if bit >> i & 1 == 1 {
                    now += 1;
                }
            }

            let mut ok = true;
            for i in 0..now + 1 {
                if memo[i] + tmp[i] > k {
                    ok = false;
                }
            }
            if ok {
                good = true;
                for i in 0..now + 1 {
                    memo[i] += tmp[i];
                }
            } else {
                count += 1;
                for i in 0..now + 1 {
                    memo[i] = tmp[i];
                }
            }
        }
        if good {
            ans = std::cmp::min(ans, count + (bit as u32).count_ones());
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

bool is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

int main()
{
    string s; cin >> s;
    rep(i,s.length()) {
        if (i % 2 == 0)
            cout << s[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e15;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> x(n), y(n), h(n);
    rep(i, 0, n){
        cin >> x[i] >> y[i] >> h[i];
    }   
    rep(i, 0, 101){
        rep(j, 0, 101){
            int H = INF;
            rep(k, 0, n){
                int tmp = abs(x[k] - i) + abs(y[k] - j);
                int tmph = h[k] + tmp;
                chmin(H, tmph);
            }
            bool f = true;
            rep(k, 0, n){
                int tmp = abs(x[k] - i) + abs(y[k] - j);
                int tmph = max(H - tmp, 0LL);
                if(tmph != h[k]){
                    f = false; break;
                }
            }
            if(f){
                cout << i << ' ' << j << ' ' << H << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[10];
char c[10];
char s[10];
int main()
{
    for(int i=1;i<=10;i++)
    s[i]='0';
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>a[i]>>c[i];
        if(a[i]==1&&c[i]=='0'&&n>1)
        {
            cout<<-1<<endl;
            return 0;
        }
        for(int j=1;j<i;j++)
        {
            if(a[j]==a[i]&&c[i]!=c[j])
            {
                cout<<-1<<endl;
                return 0;
            }
        }
        s[a[i]]=c[i];
        
    }
    if(n==1&&s[1]=='0') 
    {
        cout<<0<<endl;
        return 0;
    }
    if(s[1]=='0'&&n>1) s[1]='1';
    for(int i=1;i<=n;i++)
    {
        cout<<s[i];
    }
    puts("");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;

ll count_ak(ll n) {
    if (n == 1LL) {
        return 0LL;
    }
    // for k == n
    ll cnt = 1LL;

    ll i = 2LL;
    while (i * i < n) {
        if (n % i == 0LL) {
            // i, n / i
            cnt += 2LL;
        }
        i++;
    }
    if (i * i == n) {
        cnt++;
    }
    return cnt;
}

int main(int argc, char const *argv[]) {
    ll n;
    cin >> n;
    ll ans = 0LL;
    // k == n
    ans += 1LL;
    ans += count_ak(n - 1LL);
    // cout << ans << endl;

    vector<ll> divs;
    ll i = 1LL;
    while (i * i <= n) {
        if (n % i == 0LL) {
            divs.push_back(i);
            if (i * i != n) {
                divs.push_back(n / i);
            }
        }
        i++;
    }
    sort(divs.begin(), divs.end());
    for (auto k: divs) {
        if (k == 1) {
            continue;
        }
        if (k == n) {
            break;
        }
        ll m = n;
        while (m % k == 0) {
            m = m / k;
        }
        // a * K + 1?
        if (m % k == 1LL) {
            ans += 1LL;
        }
    }
    cout << ans << endl;
    return 0;    
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;

    ll N, K;
    cin >> N >> K;
    vector<ll> h(N + K + 5, 0);
    rep(i, N) cin >> h[i];

    vector<ll> dp(N + K + 5, INF);
    dp[0] = 0;
    rep(i, N) {
        reps(j, 1, K + 1) { chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j])); }
    }

    // rep(i, N) cout << dp[i] << " ";
    // cout << endl;

    cout << dp[N - 1] << endl;

    return 0;
}

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


struct tree{
	tree* left;
	tree* right;
	tree* parent;
	int val;
};

void printPreorder(tree* root){
	if(root== NULL)return;
	cout << " " << root->val;
	printPreorder(root->left);
	printPreorder(root->right);
	return;
}
void printInorder(tree* root){
	if(root== NULL)return;
	printInorder(root->left);
	cout << " " << root->val;
	printInorder(root->right);
	return;
}

tree* findNode(int val, tree* root){
	if(root->val == val)return root;

	tree* next;
	if(val < root->val)next = root->left;
	else next = root->right;

	if(next)return findNode(val,next);
	else return NULL;
}
tree* getMini(tree* root){
	if(root->left== NULL)return root;
	else return getMini(root->left);
};

void deleteNode(tree* node){
	if(node == NULL)return;
	bool nodeIsRoot = node->parent == NULL;
	bool nodeIsLeft = false;
	if(!nodeIsRoot)nodeIsLeft = node->parent->left == node;
	tree* subNode = NULL;
	if(node->left == NULL && node->right == NULL){
	}else if(node->left != NULL && node->right != NULL){
		subNode = getMini(node->right);
		if(subNode -> right!= NULL){
			if(subNode != node->right){
				subNode->parent->left = subNode->right;
			}else{
				subNode->parent->right= subNode->right;
			}
			subNode->right->parent = subNode->parent;
		}else{
			if(subNode != node->right){
				subNode->parent->left= NULL;
			}else{
				subNode->parent->right= NULL;
			}
		}
		subNode->left = node->left;
		if(node->left)node->left->parent = subNode;
		subNode->right = node->right;
		if(node->right)node->right->parent = subNode;
	}else{
		if(node->left == NULL)subNode = node->right;
		else subNode = node->left;
	}


	if(subNode != NULL){
		subNode->parent = node->parent;
	}
	if(nodeIsLeft){
		node->parent->left = subNode;
	}else if(!nodeIsRoot){
		node->parent->right = subNode;
	}

	free(node);
};

void insert(int val, tree* root){
	tree* next;
	bool flag = val < root->val;
	if(flag)next = root->left;
	else next = root->right;

	if(next == NULL){
		tree* newNode = (tree*)malloc(sizeof(tree));
		newNode->val = val;
		newNode->left = NULL;
		newNode->right = NULL;
		newNode->parent = root;
		if(flag)root->left = newNode;
		else root->right = newNode;
	}else{
		insert(val,next);
	}
}

int main(){
	ios_base::sync_with_stdio(false);

	tree* root = (tree*)malloc(sizeof(tree));

	char order[10];
	int val;
	int numOfOrder;

	cin >> numOfOrder;
	cin >> order;
	cin >> val;

	root->val = val;
	root->left = NULL;
	root->right = NULL;
	root->parent = NULL;


	for(int i = 0; i <  numOfOrder - 1; i++){
		cin >> order;
		if(order[0] == 'i'){
			cin >> val;
			insert(val, root);
		}else if(order[0] == 'p'){
			printInorder(root);
			cout << endl;
			printPreorder(root);
			cout << endl;
		}else if(order[0] == 'f'){
			cin >> val;
			if(findNode(val, root) == NULL)cout << "no" << endl;
			else cout << "yes" << endl;
		}else{
			cin >> val;
			deleteNode(findNode(val, root));    
		}
	}
	return 0;

}

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

using namespace std;

int main(){
  int n, k, x, y;
  cin>>n>>k>>x>>y;
  int answer;

  if(n<=k){
    answer = n*x;   
  }
  else if(n>k){
    answer = k*x + (n-k)*y;
  }

  cout<<answer<<endl;

}


Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <cmath>
#include <map>
#include <array>
#include <set>
#include <queue>
#include <complex>
#include <iterator>
#include <random>
#include <time.h>
#include <tuple>
#include <functional>
#include <list>
#include <limits.h>
#define mp make_pair
#define ni(x) scanf("%d", &(x))
#define nii(x,y) scanf("%d%d",&(x),&(y))
#define mul(x,y) ((ll)(x)*(y)%mod)
#define mtp make_tuple
#define F(i,n) for(int i = 0; i < (n); i++)
#define FF(i,n) for(int i = 1; i <= (n); i++)
#define FE(i,n) for(int i = 0; i <= (n); i++)

#ifndef __GNUG__
int __builtin_popcount(int n) {
	int x = 0;
	while (n)n -= n&(-n), x++;
	return x;
}
#endif

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const int mod = 1000000007;
const int inf = 2012345678;
const ll infl = 9012345678901234567;
const double pi = 3.1415926535897932384626433832795;
//----------------------------------------------------------------------------//


int modpow(int n, int e) {
	if (!e)return 1;
	int t = modpow(n, e / 2);
	t = mul(t, t);
	if (e & 1)t = mul(t, n);
	return t;
}

int inv(int i) {
	i %= mod;
	if (i == 1)return 1;
	else return mul(mod - mod / i, inv(mod%i));
}


int main() {
#ifndef __GNUG__
	freopen("input.txt", "r", stdin);
#endif
	
	int n, a, b, c; nii(n, a); nii(b, c);
	int X = inv(100);
	a = mul(a, X), b = mul(b, X), c = mul(c, X);
	int p = mul(a, inv(mod + 1 - c)), q = mul(b, inv(mod + 1 - c)), ncr = 1, ans = 0;
	
	F(i, n) {
		ans += mul(modpow(p, n), mul(modpow(q, i), mul(n + i, ncr)));
		ans %= mod;
		ncr = mul(ncr, n + i);
		ncr = mul(ncr, inv(i + 1));
	}
	swap(p, q); ncr = 1;
	F(i, n) {
		ans += mul(modpow(p, n), mul(modpow(q, i), mul(n + i, ncr)));
		ans %= mod;
		ncr = mul(ncr, n + i);
		ncr = mul(ncr, inv(i + 1));
	}
	printf("%d\n", mul(ans, inv(mod + 1 - c)));

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};
vector<vector<ll>> dp(405,vector<ll>(405,-1));
vector<ll> w(400);
ll N;


ll daruma(ll l, ll r){

    if(dp[l][r] >= 0){
        return dp[l][r];
    } 
    if(abs(l - r) <= 1) return 0;

    ll ret = 0;  
    if(daruma(l+1,r-1) == r-l-2 && abs(w[r-1]-w[l]) <= 1){
        ret = r-l;
    }else{
        for(ll mid = l+1;mid <=r-1;mid++){
            chmax(ret,daruma(l,mid)+daruma(mid,r));
        }
    }

    return dp[l][r] = ret;
}

int main() {
    while(1){
    cin >> N;
    //dp.clear();
    rep(i,400){
        rep(j,400){
            dp[i][j] = -1;
        }
    }
    w.clear();
    if(N==0)break;
    rep(i,N){
        cin >> w[i];
    }
    //cout << "OK"<<endl;
    /*rep(i,N){
        dp[i][i] = 0;
    }*/
    
    ll ans = 0;

    

    cout <<daruma(0,N)<<endl;;
    }
    return 0;
    

}



Measured memory_bytes: 3904
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//

struct union_find {
    vector<int> par;

    union_find(int n) : par(n) {
        for(int i = 0; i < n; i++) {
            par[i] = i;
        }
    }

    int find(int x) {
        if (par[x] == x) return x;
        else {
            par[x] = find(par[x]);
            return par[x];
        }
    }

    void unite(int x, int y) {
        int rx = find(x);
        int ry = find(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = find(x);
        int ry = find(y);
        return rx == ry;
    }
};

int main() {
    int n,m; cin>>n>>m;
    vector<vector<int>> edge(m,vector<int>(2,0));
    rep(i,m) cin>>edge[i][0]>>edge[i][1];
    int ans=0;
    for (int i = 0; i < m; i++)
    {
        union_find tree(n);
        for (int j = 0; j < m; j++)
        {
            if(j==i) continue;
            tree.unite(edge[j][0]-1, edge[j][1]-1);
        }
        if(tree.same(edge[i][0]-1,edge[i][1]-1)==false){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

#define Len 10001
int main()
{
    int n;
    char s[Len];
    
    scanf("%d", &n);

    scanf("%s", s);
    int l = strlen(s);

    
    for (int i = 0; i < l; i++){
        
        if (s[i] + n > 90)
            s[i] = 65 + (s[i] + n - 91);
        else{
            s[i] += n;
        }
        
        printf("%c", s[i]);
    }
    printf("\n");
    
    
    return 0;
}   



Measured memory_bytes: 128
n, l = map(int, input().split())
apple = list()
for i in range(n):
    apple.append(l+i)
if l < 0:
    if l+n-1 > 0:
        apple.remove(0)
    else:
        apple.pop(-1)
elif l > 0:
    if l+n+1<0:
        apple.remove(0)
    else:
        apple.pop(0)
else:
    apple.remove(0)
print(sum(apple))

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

map<string, int> memo;
int main(){
    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        memo[s] += 1;
    }

    int maxv = 0;
    for(auto& x:memo){
        // cout << x.second <<'\n';
        int v = x.second;
        if(v > maxv) maxv = v;
    }
    for(auto it = memo.begin(); it != memo.end(); it++){
        if(it->second == maxv){
            cout << it->first << endl;
        }
    }
    return 0;


}

Measured memory_bytes: 17664
#include<iostream>
using namespace std;
int main() {
	int a, b, d, r;
	double f, g,z;
	cin >> a >> b;
	d = a / b;
	r = a % b;
	f = a, g = b;
	z = f / g;
	printf("%d %d %lf", d, r, z);
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)((x).size())
#define mp make_pair

using namespace std;

typedef unsigned long long ull;
typedef pair<int,int> ii;

template<class U,class T>ostream& operator<<(ostream& out, pair<U,T> & P){
    return out << "[" << P.first << ", " << P.second << "]";
}
template<class T>ostream& operator<<(ostream& out, vector<T> & V){
    if(!V.empty())out << "[";
    for(int i = 0; i < sz(V); i++)out << V[i] << (i+1==sz(V)?"]":", ");
    return out;
}

int main(){
    ios_base::sync_with_stdio(false);
    long long H;
    long long N;
    cin >> H >> N;
    vector<double> V(N);
    for(auto & i:V){
        cin >> i;
        H-=i;
    }
    cout << (H > 0? "No":"Yes") << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n = 0;
  cin >> n;
  vector<long long> a(n), b(n);
  for (int i=0; i<n; i++) {
    cin >> a.at(i);
  }
  for (int i=0; i<n; i++) {
    cin >> b.at(i);
  }
  long long cnt2 = 0, cnt1 = 0;
  for (int i=0; i<n; i++) {
    if (a.at(i) < b.at(i)) {
      if ((b.at(i) - a.at(i)) % 2 == 0) {
        cnt2 += (b.at(i) - a.at(i)) / 2;
        a.at(i) = b.at(i);
      } else {
        cnt2 += (b.at(i) - a.at(i)) / 2 + 1;
        a.at(i) = b.at(i) + 1;
      }
    }
  }
  for (int i=0; i<n; i++) {
    if (b.at(i) < a.at(i)) {
      cnt1 += a.at(i) - b.at(i);
    }
  }
  if (cnt2 >= cnt1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);
const ll MOD = (ll)(1e9 + 7);

/////////////////////////////////////////////////////////////
class ModuloOperator {
public:
  ll mo_modulo;

  ModuloOperator(ll modulo) {
    mo_modulo = modulo;
  }

  ll add(ll a, ll b) {
    ll ret = a + b;
    ret %= mo_modulo;
    return ret;
  }

  ll sub(ll a, ll b) {
    ll ret = a - b;
    if (ret < 0) ret += mo_modulo;
    else ret %= mo_modulo;
    return ret;
  }

  ll mul(ll a, ll b) {
    ll ret = a * b;
    ret %= mo_modulo;
    return ret;
  }

  ll div(ll a, ll b) {
    return mul(a, pow(b, mo_modulo - 2));
  }

  ll pow(ll x, ll y) {
    ll res = 1LL;

    x %= mo_modulo;

    while (y > 0) {
      if (y & 1) {
        res = mul(res, x);
      }

      y = y >> 1;
      x = mul(x, x);
    }

    return res;
  }
};
/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
class CombinationModulo {
public:
  static const int MAX_N_LIB = (int)(2e5 + 100);
  static const ll MOD_LIB = (ll)(1e9 + 7);

  ll fact[MAX_N_LIB];
  ll inv[MAX_N_LIB];
  ll fact_inv[MAX_N_LIB];

  CombinationModulo(int n) {
    init(n);
  }

  void init(int n) {
    inv[1] = fact[0] = fact_inv[0] = 1;
    for (int i = 2; i <= n; i++) {
      inv[i] = (MOD_LIB - (MOD_LIB / i) * inv[MOD_LIB % i] % MOD_LIB) % MOD_LIB;
    }
    for (int i = 1; i <= n; i++) {
      fact[i] = fact[i - 1] * i % MOD_LIB;
    }
    for (int i = 1; i <= n; i++) {
      fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD_LIB;
    }
  }

  ll comb(int n, int r) {
    if (r > n) return 0;
  	return fact[n] * fact_inv[r] % MOD_LIB * fact_inv[n - r] % MOD_LIB;
  }
};
/////////////////////////////////////////////////////////////

int n;
ll a, b, c;

ll a_div_apb_arr[MAX_N];
ll b_div_apb_arr[MAX_N];

ll ans;

ModuloOperator mo(MOD);

int main(void) {
  // Here your code !
  scanf("%d %lld %lld %lld", &n, &a, &b, &c);

  CombinationModulo cm(n + n + 3);

  ll a_div_apb = mo.div(a, mo.add(a, b));
  ll b_div_apb = mo.div(b, mo.add(a, b));

  ll hund_div_hund_sub_c = mo.div(100LL, mo.sub(100LL, c));

  a_div_apb_arr[0] = 1LL;
  b_div_apb_arr[0] = 1LL;

  for (int i = 1; i <= n; ++i) {
    a_div_apb_arr[i] = mo.mul(a_div_apb_arr[i - 1], a_div_apb);
    b_div_apb_arr[i] = mo.mul(b_div_apb_arr[i - 1], b_div_apb);
  }

  ans = 0;

  for (int i = 0; i <= n - 1; ++i) {
    ll combination = cm.comb(n - 1 + i, n - 1);

    ll after_fst = mo.mul(a_div_apb_arr[n], b_div_apb_arr[i]);
    ll after_snd = mo.mul(b_div_apb_arr[n], a_div_apb_arr[i]);
    ll after = mo.add(after_fst, after_snd);

    ll expect_fst = mo.mul(n + i, mo.mul(combination, after));

    ans = mo.add(ans, expect_fst);
  }

  ans = mo.mul(ans, hund_div_hund_sub_c);

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

  return 0;
}


Measured memory_bytes: 6528