akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

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

	vector<int> p(m);
	vector<string> s(m);
	for (int i = 0;i < m;i++) {
		cin >> p[i] >> s[i];
	}

	vector<int> seikai(n + 1);
	int ac = 0;
	int pena = 0;
	vector<int> wa(n + 1);

	for (int i = 0;i < m;i++) {
		if (seikai[p[i]] == 0) {
			if (s[i] == "WA") {
				wa[p[i]]++;
			}
			else {
				seikai[p[i]] = 1;
				ac++;
				pena += wa[p[i]];
			}
		}
	}

	cout << ac << " " << pena << endl;

	return 0;
}

//BBBBBBBBBBBBBBBBBB
//int main() {
//	int n, k, m;
//	cin >> n >> k >> m;
//
//	int sum = 0;
//	vector<int> a(n);
//	for (int i = 0;i < n - 1;i++) {
//		cin >> a[i];
//		sum += a[i];
//	}
//
//	if (n * m - sum - k > 0) {
//		cout << -1 << endl;
//	}
//	else {
//		cout << max(n * m - sum,0) << endl;
//	}
//
//	return 0;
//}

//AAAAAAAAAAAAAAAAA
//int main() {
//	char c;
//	cin >> c;
//	cout << (char)(c + 1) << endl;
//
//	return 0;
//}

Measured memory_bytes: 7468
#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>;

// totalの約数、それぞれのmod

vector<ll> MakeDivisors(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n%i == 0) {
      ret.push_back(i);
      if(i*i != n) ret.push_back(n/i);
    }
  }
  sort(ret.rbegin(), ret.rend());
  return ret;
}

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  ll total = accumulate(a.begin(), a.end(), 0);
  vector<ll> divs = MakeDivisors(total);
  ll ans = 1;
  for (ll d : divs) {
    vector<ll> b(n);
    rep(i, n) b[i] = a[i] % d;
    sort(b.begin(), b.end());
    vector<ll> c(n);
    rep(i, n) c[i] = d - b[i];
    rep(i, n) {
      if (i > 0) b[i] += b[i-1];
    }
    rep(i, n) {
      if (i > 0) c[i] += c[i-1];
    }
    rep(i, n) {
      ll x = b[i];
      ll y = c[n-1] - c[i];
      if (x > k) break;
      if (y > k) continue;
      if ((x+y) / 2 <= k) {
        ans = d;
        goto OUT;
      }
    }
  }
  OUT:
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>

template <typename Weight>
struct edge {
  using value_type = Weight;
  size_t src, dst;
  value_type cost;

  edge(size_t src, size_t dst, value_type cost = 1):
    src(src), dst(dst), cost(cost)
  {}

  bool operator <(edge<value_type> const& rhs) const {
    if (cost != rhs.cost) return cost < rhs.cost;
    if (src != rhs.src) return src < rhs.src;
    return dst < rhs.dst;
  }
};

template <typename Weight>
struct graph: public std::vector<std::vector<edge<Weight>>> {
  using value_type = Weight;
  graph(size_t n): std::vector<std::vector<edge<value_type>>>(n) {}

  void connect_to(size_t src, size_t dst, value_type cost = 1) {
    (*this)[src].emplace_back(src, dst, cost);
  }

  void connect_with(size_t src, size_t dst, value_type cost = 1) {
    connect_to(src, dst, cost);
    connect_to(dst, src, cost);
  }
};

template <class Tp>
constexpr Tp inf = Tp(1) << (8*sizeof(Tp)-3);

template <class Weight>
std::vector<Weight> shortest(const graph<Weight>& g, size_t s) {
  // based-on Bellman-Ford algorithm
  size_t V = g.size();
  std::vector<Weight> res(V, inf<Weight>);
  res[s] = 0;

  for (size_t i = 1; i < V; ++i)
    for (size_t v = 0; v < V; ++v) {
      if (res[v] == inf<Weight>) continue;
      for (const auto& e: g[v])
        if (res[e.dst] > res[e.src] + e.cost)
          res[e.dst] = res[e.src] + e.cost;
    }

  for (size_t i = 0; i < V; ++i)
    for (size_t v = 0; v < V; ++v) {
      if (res[v] == inf<Weight>) continue;
      for (const auto& e: g[v])
        if (res[e.dst] > res[e.src] + e.cost)
          res[e.dst] = -inf<Weight>;
    }

  return res;
}

int main() {
  size_t N, M;
  intmax_t P;
  scanf("%zu %zu %jd", &N, &M, &P);

  graph<intmax_t> g(N);
  for (size_t i = 0; i < M; ++i) {
    size_t A, B;
    intmax_t C;
    scanf("%zu %zu %jd", &A, &B, &C);
    --A, --B;
    g.connect_to(A, B, P-C);
  }

  auto res = shortest(g, 0)[N-1];
  if (res == -inf<intmax_t>) return puts("-1"), 0;
  printf("%jd\n", std::max<intmax_t>(0, -res));
}


Measured memory_bytes: 640
// In the name of Allah
// #Isart

#include<bits/stdc++.h>

#define pii pair<int, int>
#define pb push_back
#define F first
#define S second
#define ll long long
#define ld long double

using namespace std;

const int MAXN = 1e6 + 10;
int a[MAXN], b[MAXN], cnt[MAXN], c[MAXN];
bool mark[MAXN];
map<int, int> ind;
vector<int> adj[MAXN];

void dfs(int v){
	mark[v] = true;
	for(auto u : adj[v])
		if(mark[u] == false) 
			dfs(u);
}

int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	int n, mis = 0, total = 0, in = 1; cin >> n;
	for(int i = 0; i < n; i ++) cin >> a[i], c[i] = a[i], total ^= a[i];
	for(int i = 0; i < n; i ++) cin >> b[i], c[i + n] = b[i];
	c[2 * n] = total;
	sort(c, c + 2 * n + 1);
	for(int i = 0; i < 2 * n + 1; i ++){
		if(i and c[i] == c[i - 1]) continue;
		ind[c[i]] = in ++;
	} 
	total = ind[total];
	for(int i = 0; i < n; i ++) a[i] = ind[a[i]];
	for(int i = 0; i < n; i ++) b[i] = ind[b[i]];
	for(int i = 0; i < n; i ++){
		if(a[i] == b[i]) {
			b[i] = -1; a[i] = -1;
			continue;
		}
		cnt[a[i]] ++;
		adj[a[i]].pb(b[i]);
		adj[b[i]].pb(a[i]);
		mis ++;
	}	
	cnt[total] ++; a[n] = total;
	for(int i = 0; i < n; i ++){
		if(b[i] < 0) continue;
		cnt[b[i]] --;
		if(cnt[b[i]] == -1) return cout << -1, 0;
	}
	int tedad = 0;
	for(int i = 0; i < n + 1; i ++){
		if(a[i] == -1) continue;
		if(mark[a[i]] == false) dfs(a[i]), tedad ++;
	}
	if(mis == 0) cout << 0 << endl;
	else cout << mis + tedad - 1 << endl;
	return 0;	
}

Measured memory_bytes: 45952
#include <iostream>

using namespace std;

struct ele {
    string s;
    int id;
};

bool bubbleSort(ele *a, int n) {
    for (int i = 0; i < n; ++i) {
        for (int j = n - 1; j > i; --j) {
            if (a[j - 1].s[1] > a[j].s[1]) {
                swap(a[j - 1], a[j]);
            }
        }
    }
    return true;
}

bool selectSort(ele *a, int n) {
    for (int i = 0, minj; i < n; ++i) {
        minj = i;
        for (int j = i; j < n; ++j) {
            if (a[minj].s[1] > a[j].s[1]) {
                minj = j;
            }
        }
        swap(a[i], a[minj]);
    }
    for (int i = 0; i < n - 1; ++i) {
        if (a[i].s[1] == a[i + 1].s[1]) {
            if (a[i].id > a[i + 1].id)
                return false;
        }
    }
    return true;
}

void printArray(ele *a, int n) {
    for (int i = 0; i < n; ++i) {
        cout << a[i].s;
        if (i < n - 1)
            cout << " ";
    }
    cout << endl;
}

void printStatus(bool f) {
    if (f)
        cout << "Stable" << endl;
    else
        cout << "Not stable" << endl;
}

int main() {
    int n;
    bool f;
    ele a[36], b[36];
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i].s;
        a[i].id = i;
    }

    copy(a, a + n, b);
    f = bubbleSort(b, n);
    printArray(b, n);
    printStatus(f);
    
    copy(a, a + n, b);
    f = selectSort(b, n);
    printArray(b, n);
    printStatus(f);

    return 0;
}


Measured memory_bytes: 3212
from collections import Counter

n = int(input())
a = list(map(int,input().split()))
cnt = dict(Counter(a))
ans = 0
for _,c in cnt.items():
  if c >= 2:
    ans += c*(c-1)//2
    
for i in range(n):
  pop_i = a[i]
  # n(n-1)/2 - (n-1)(n-2)/2 = n-1
  dif = cnt[pop_i]-1
  print(ans-dif)



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

int main(){
    int A,B;
    cin >> A >> B;
    int sum=0;
    
    for(int i=0;i<2;i++){
        if(A >= B){
            sum += A;
            A -= 1;
        }
        else{
            sum += B;
            B -= 1;
        }
    }
    
    cout << sum << endl;
}


Measured memory_bytes: 256
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
//#include<iostream>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
const int MAXN=1e5;
int n_pnt,n_edg;
struct NODE{
	int p,val;//val+p*x>0
	NODE(){}
	NODE(int a,int b){p=a;val=b;}
};
struct QUEUE{
	int u,p;//val+p*x>0
	long long val;
	QUEUE(){}
	QUEUE(int a,int b,long long c){u=a;p=b;val=c;}
};
vector<pair<int,int> > lnk[MAXN+5];
long long vis[2][MAXN+5];//vis[0][i]-x>0 && vis[1][i]+x>0 -> x<vis[0] && x>-vis[1]
inline int G(int p){return p==1;}
long long MIN=-1e15,MAX=1e15;
int main()
{
	fill(vis[0],vis[0]+MAXN+5,1e15);
	fill(vis[1],vis[1]+MAXN+5,1e15);
	scanf("%d%d",&n_pnt,&n_edg);
	for(int i=0,u,v,l;i<n_edg;i++)
		scanf("%d%d%d",&u,&v,&l),
		lnk[u].push_back(make_pair(v,l)),lnk[v].push_back(make_pair(u,l));
	queue<QUEUE> que;
	que.push(QUEUE(1,1,0));
	while(!que.empty())
	{
		QUEUE fro=que.front();que.pop();
		for(int i=0;i<lnk[fro.u].size();i++)
		{
			int v=lnk[fro.u][i].first,l=lnk[fro.u][i].second;
			long long val=l-fro.val;int p=fro.p==1? -1:1;
			if(vis[G(p)][v]!=1e15)
			{
				if(val!=vis[G(p)][v])
				{
					printf("%d\n",0);
					return 0;
				}
				else
					continue;
			}
			vis[G(p)][v]=val;
			if(G(p))
				MIN=max(MIN,max((long long)0,-vis[1][v]));
			else
				MAX=min(MAX,vis[0][v]);
			que.push(QUEUE(v,p,val));
		}
	}
	long long ans=-1;
	for(int i=1;i<=n_pnt;i++)
		if(vis[0][i]!=1e15 && vis[1][i]!=1e15)
		{
			int res=(vis[0][i]-vis[1][i])/2;
			if(res<0) {printf("0\n");return 0;}
			if(ans==-1) ans=res;
			if(ans!=res) {printf("0\n");return 0;}
		}
	if(ans!=-1)
	{
		if(MIN<ans && ans<MAX)
			printf("%d\n",1);
		else
			printf("%d\n",0);
		return 0;
	}
	if(MAX-MIN-1<0) printf("%d\n",0);
	else printf("%lld\n",MAX-MIN-1);
	return 0;
}
/*
2 1
1 2 3
*/


Measured memory_bytes: 9716
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {

    long long int n;
    cin >> n;

    vector< long long int > v;
    vector< long long int > vv;

    for ( long long int i = 0; i < n; i++ ) {
        long long int a;
        cin >> a;
        long long int c = 0;
        long long int cc = 0;
        for ( long long int j = 0; j < a; j++ ) {
            long long int x, y;
            cin >> x >> y;
            x--;
            if ( y == 0 ) {
                cc += 1LL << x;
            } else {
                c += 1LL << x;
            }
        }
        v.push_back( c );
        vv.push_back( cc );
    }

    long long int ans = 0;

    for ( long long int i = 0; i < ( 1LL << n ); i++ ) {
        long long int ii = ( ( 1LL << n ) - 1 ) ^ i;
        long long int c = 0;
        bool f = true;
        for ( long long int p = 0; p < n; p++ ) {
            long long int q = ( 1LL << p );
            if ( ( i & q ) == 0 ) continue;
            if ( ( ( i & v[p] ) ^ v[p] ) != 0 ) {
                f = false;
                break;
            }
            if ( ( ( ii & vv[p] ) ^ vv[p] ) != 0 ) {
                f = false;
                break;
            }
            c++;
        }
        if ( f ) ans = max( ans, c );
    }

    cout << ans << endl;

    return 0;

}


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

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(a%2==0 or b%2==0 or c%2==0){
        cout<<0<<endl;
    }else if(a<=c and b<=c){
        cout<<a*b<<endl;
    }else if(b<=a and c<=a){
        cout<<b*c<<endl;
    }else if(a<=b and c<=b){
        cout<<a*c<<endl;
    }
     return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
)

var (
	nextToken func() ([]byte, error)
	nextLine  func() ([]byte, error)

	OutputBuffer *bufio.Writer

	OutputWriter io.Writer
)

// set up IO functions
func init() {

	SetInput(os.Stdin)
	SetOutput(os.Stdout)

}
// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}
func main() {
	defer Flush()

	S := reads()
	n := len(S) - 1
	if S[n] == 's' {
		println(S + "es")
	} else {
		println(S + "s")
	}
}



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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

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

    string s;
    cin >> s;
    
    map<char, int> mp;
    REP(i, s.size())  mp[s[i]]++;

    LL ans = 1;
    REP(i, s.size()){
        ans += s.size() - i - mp[s[i]];
        mp[s[i]]--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 720
def solve(a, b):
    if a < 0 and 0 < b:
        return 'Zero'
    if 0 < a:
        return 'Positive'
    length = b - a + 1
    return 'Positive' if length % 2 == 0 else 'Negative'


a, b = map(int, input().split())
print(solve(a, b))


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

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			String[] s = sc.nextLine().split(" ");
			int a = Integer.parseInt(s[0]);
			String op = s[1];
			int b = Integer.parseInt(s[2]);
			if ("?".equals(op)) {
				return;
			}
			if ("+".equals(op)) {
				System.out.println(a + b);
			} else if ("*".equals(op)) {
				System.out.println(a * b);
			} else if ("/".equals(op)) {
				System.out.println(a / b);
			} else if ("-".equals(op)) {
				System.out.println(a - b);
			}
		}
	}
}

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;

int main(){
    ll n;
    cin >> n;
    ll ans;
    int loop = sqrt(n);
    REPN(i, 1, loop+1) {
        if(n%i == 0) ans = i;
    }

    ll a = ans;
    ll b = n/ans;
    int ans2 = 0;
    //cout << "a" << endl;
    while(b > 0) {
        ans2++;
        b/=10;
    }
    //cout << "a" << endl;
    cout << ans2 << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    map<int, int>m;
    rep(i, 3){
        int a;
        cin >> a;
        m[a]++;
    }
    if(m.size()==2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
if n == 1 and m == 1:
	print (1)
	exit()
if n == 1 or m == 1:
	print (max(max(n,m)-2,0))
elif n == 2 or m == 2:
	print (0)
else:
	print ((n-2)*(m-2))



Measured memory_bytes: 3060
/*
 ABC149 C
 auther: takeheroaf
 created at 2020-1-2 15:4:6
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vc vector
#define a first
#define b second
#define pb push_back
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)

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

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

bool isprime(int x){
  if(x == 1) return false;
  if(x == 2) return true;
  rep(i, 2, pow(x, 0.5) + 1){
    if(x % i == 0){
      return false;
    }
  }
  return true;
}

/////////////////////////////////////////////////////////
void Main(){
  int x; cin >> x;
  while(true){
    if(isprime(x)){
      cout << x << endl;
      break;
    }
    x++;
  }
  return;
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << std::fixed << std::setprecision(15);

  Main();

  return 0;
}


Measured memory_bytes: 256
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n;
ll a[100111],A,B,dp[100111];
int main()
{
	getiii(n,A,B);
	if(A>B)swap(A,B);
	for(int i=1;i<=n;i++)geti(a[i]);
	dp[0]=1;a[0]=-B;
	a[n+1]=a[n]+B;
	for(int i=2;i<n;i++)
	{
		if(a[i+1]-a[i-1]<A)
		{
			puts("0");
			return 0;
		}
	}
	n++;
	ll ans=0;
	int it=0,itr=0;
	for(int i=1;i<=n;i++)
	{
		while(itr+1<i&&a[i]-a[itr+1]>=B)itr++;
		dp[i]=dp[i-1];
		if(it<=itr)
		{
			dp[i]=(dp[i]+dp[itr])%mod;
			if(it>0)dp[i]=(dp[i]-dp[it-1]+mod)%mod;
		}
		if(i>1&&a[i]-a[i-1]<A)it=max(it,i-1);
	}
	cout<<(dp[n]-dp[n-1]+mod)%mod<<endl;
	return 0;
}

Measured memory_bytes: 1920
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]


N, P = map(int, input().split())  # 袋がN個, 2をPにしたい
A = list(map(lambda x: int(x)%2, input().split()))
# print(A)

kisuu = sum(A)  # 奇数個の袋の数
guusuu = N-kisuu  # 偶数個の袋の数

# Pが1のとき，偶数側の袋を任意の数と，奇数側の数を奇数個選ぶ
if P == 1:
    tmp_guusuu = 0
    tmp_kisuu = 0
    # 偶数側を任意の個数選ぶ
    for i in range(guusuu+1):
        tmp_guusuu += cmb(guusuu, i)
    for i in range(kisuu+1):
        if i % 2 == 0:
            continue
        tmp_kisuu += cmb(kisuu, i)
    print(tmp_guusuu*tmp_kisuu)

# Pが0のとき，偶数側の袋を任意の数と，奇数側の数を偶数個選ぶ
elif P == 0:
    tmp_guusuu = 0
    tmp_kisuu = 0
    # 偶数側を任意の個数選ぶ
    for i in range(guusuu+1):
        tmp_guusuu += cmb(guusuu, i)
    # 奇数側を0個数以上の偶数個選ぶ
    for i in range(kisuu+1):
        if i % 2 == 1:
            continue
        tmp_kisuu += cmb(kisuu, i)
    print(tmp_guusuu*tmp_kisuu)


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <math.h>

using namespace std;

int lcm(vector<int> ns) {
	int m = 1;
	for (int i = 2; ns.size() != 0; ++i) {
		int count_max = 0;
		for (vector<int>::iterator it = ns.begin(); it != ns.end();) {
			int count = 0;
			while (*it % i == 0) {
				++count;
				*it /= i;
			}
			if (count_max < count) count_max = count;

			if (*it == 1) ns.erase(it);
			else ++it;
		}
		m *= pow(i, count_max);
	}
	return m;
}

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

	vector<int> ns;
	while (n--) {
		int a;
		cin >> a;
		ns.push_back(a);
	}
	cout << lcm(ns) << endl;
	return 0;
}

Measured memory_bytes: 1252
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int K = scanner.nextInt();

    if ( K % 2 == 0) {
      int n = K/2;
      System.out.println(n * n);
    } else {
      int n = (K+1)/2;
      System.out.println(n * (n-1));
    }
  }
}


Measured memory_bytes: 23124
import sys


def factorize(n):
    fct = []
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


input = sys.stdin.readline
N, P = map(int, input().split())
c = 1
for b, e in factorize(P):
    c *= b ** (e // N)
print(c)


Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	int a = 0, b = 0, c = 0;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		if (x % 4 == 0)
		{
			a++;
		}
		else if (x % 2 == 0)
		{
			b++;
		}
		else
		{
			c++;
		}
	}

	bool ok = true;
	if (a < c)
	{
		ok = false;
	}

	if (a + 1 == c && n == a + c)
	{
		ok = true;
	}

	cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define debug(x) cout<<"### x is: "<<x<<"###"<<endl
#define all(a) a.begin(),a.end()
#define tc int t;scanf("%d",&t);while (t--0)
#define int long long
const int MOD=1e9+7;
const int N=1e5+5;
int power(int a, int b) {int ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
int invmod(int x) {return power(x,MOD-2);}
int32_t main()
{
	int n,m;
	cin>>n>>m;
	string s;
	cin>>s;
	
	for(int i=0;i<s.size();i++)
	{
		if(i+1==m)
		{
			s[i]=s[i]+32;

		}
	}
	cout<<s<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    FOR(i, 0, 3) {
        string s;
        cin >> s;
        char c = s[0] ^ 32;
        cout << c;
    }
    cout << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n,h,w;
  cin >> n >> h >> w;
  int ah=0;
  int aw=0;
  ah = n-h+1;
  aw = n-w+1;
  if(aw<0||ah<0)
    cout << 0;
  else
    cout << aw*ah;
  return 0;
}

Measured memory_bytes: 256
MOD = 1000000007

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)] + [N + 10]

dp, id = [0, 1], 0
for i in range(N):
    if A[id] - 1 == i:
        id += 1
        dp.append(0)
    else:
        dp.append(dp[-1] + dp[-2])

print(dp[-1] % MOD)


Measured memory_bytes: 460020
//BISMILLAHIR RAHMANIR RAHIM
                                               //BY THE NAME OF ALLAH
                                               //FAISAL AHAMMED SHAWON
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<set>
#include<map>
#include<iterator>
#include<numeric>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define SQ(a) (a)*(a)
#define pi acos(-1.0)
const int MAX=100001;
const int MOD=1e9+7;
int ara[MAX];
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void fast()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    else
    gcd(b,a%b);
}
ll lcd(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}

bool f(ll a,ll b)
{
    return a>b;
}
ll max_sum_subarrays(ll ara[],ll n)
{
    ll ans=0,sum=0;
    for(ll k=0;k<n;k++){
        sum=max(ara[k],sum+ara[k]);
        ans=max(ans,sum);
    }
    return ans;
}
ll num_divisors(ll n)
{
    long long cnt=0;
    for(int i=1;i*i<=n;i++)
    {
        if(n%i==0 && i*i==n)
            cnt+=1;
        if(n%i==0 && i*i!=n)
                cnt+=2;
    }
    return cnt;
}
ll comb(ll m, ll n)
{
    ll x = max(m-n,n),ans = 1,i=1;
    for(ll k=m;k>=x+1;k--){
        ans*=k;
        ans/=i;
        i++;
    }
    return ans;
}
ll binsearch(ll low,ll high,ll target)
{
    while(low<=high)
    {
        ll mid=(low+high)/2;
        if(ara[mid]>target)
            high=mid-1;
        else if(ara[mid]<target)
            low=mid+1;
        else return mid;
    }
    return -1;
}
void solve()
{
    int a,b;
    cin>>a>>b;
    if(a==b)
    {
        for(int i=1;i<=a;i++)
        {
            cout<<b;
        }
        cout<<endl;
        return;
    }
    int x=max(a,b);
    int y=min(a,b);
    for(int i=1;i<=x;i++)
        cout<<y;
    cout<<endl;
}
int main()
{
    fast();
    solve();
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL<<60;
typedef pair<ll, ll> P;

/*bool same_2(int i, int j){ return i == j && i != 0;}
bool same(int i, int j, int k){
    return same_2(i, j) || same_2(j, k) || same_2(k, i);
}*/
bool zero(int m, const vector<int> &v, vector<P> &range){
    bool res = false;
    for(P p : range){
        int num = 0;
        for(int a : v) num += a >= p.fi;
        if(p.se != num) {
            res = true;
            break;
        }
    }
    return res;
}


int main() {
    cin>>N>>M;
    vec l(M), r(M), x(M);
    vector<vector<P> > id(N + 1, vector<P>(0));
    rep(i,M){
        cin>>l[i]>>r[i]>>x[i];
        if(r[i] - l[i] + 1 < x[i]){
            cout<<0<<endl;
            return 0;
        }
        id[r[i]].emplace_back(l[i], x[i]);
    }
    vector<mat> dp(N + 1, mat(N + 1, vec(N + 1, 0)));
    ll ans = 0;
    dp[0][0][0] = 1;
    rep(i, N + 1){
        rep(j, N + 1){
            rep(k, N + 1){
                int m = max({i, j, k});
                if(zero(m, {i, j, k}, id[m]) || (i == j && i != 0) || (j == k && j != 0) || (k == i && k != 0)) {
                    dp[i][j][k] = 0;
                }else {
                    if(m == N){
                        (ans += dp[i][j][k])%=MOD;
                    }else {
                        (dp[m+1][j][k] += dp[i][j][k])%=MOD;
                        (dp[i][m+1][k] += dp[i][j][k])%=MOD;
                        (dp[i][j][m+1] += dp[i][j][k])%=MOD;
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}

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

bool IsPalindrome(string S) {
  string R = "";
  for(int i =0;i<S.size();i++){
    R += S.at(S.size()-1-i);
  }
  if(S == R) {
    return true;
  }
  else{
    return false;
  }
}

int main() {
  string S;
  cin >> S;
  string ans ="No";

  if(IsPalindrome(S)){
    int middle = (S.size()-1)/2;
    string former_S = S.substr(0,middle);
    string latter_S = S.substr(middle+1,middle);

    if(IsPalindrome(former_S)){
      if(IsPalindrome(latter_S)){
        ans = "Yes";
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int m1,d1,m2,d2;cin>>m1>>d1>>m2>>d2;
    if(m1!=m2)cout<<1;
    else cout<<0;
    return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,x,n) for(int i=x;i<n;i++)
#define breps(i,x,n) for(int i=x;i>=n;i--)
#define exrep(x,vec) for(auto&& x : vec);
#define PI 3.14159265358979323846264338327950288
const int MOD{ int(1e9 + 7) };	// = 1000000007
const int inf{ 2100000000 };	// = 2100000000 (MAX:2147483647)
typedef long long ll;
using namespace std;

/**
* ------------- ここからコード -------------
*/

int main(void) {

	ll N;
	ll ans = 0;
	cin >> N;
	vector<int> L(N);
	rep(i, N) {
		int tmp; cin >> tmp;
		L[i] = tmp;
		
	}

	for (int A = 0; A+2 < N; A++) {
		for (int B = A + 1; B+1 < N; B++) {
			for (int C = B + 1; C < N; C++) {
				if (L[A] != L[B] && L[A] != L[C] && L[B] != L[C]) {

					int c = max(L[A], L[B]); c = max(c, L[C]);
					int a, b;
					if (L[A] == c) {
						a = L[B];
						b = L[C];
					}
					else if (L[B] == c) {
						a = L[A];
						b = L[C];
					}
					else {
						a = L[A];
						b = L[B];
					}
					if (abs(a - b) < c && c < a + b) {
						ans++;
					}
				}
			}
		}
	}

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


Measured memory_bytes: 3628
N, M = map(int, input().split())
x_points = list(map(int, input().split()))

if N > M:
    print(0)
    quit()

x_points.sort()

diffs = []
for x1, x2 in zip(x_points, x_points[1:]):
    diffs.append(x2-x1)

diffs.sort()
if  N == 1:
    print(sum(diffs))
    quit()

print(sum(diffs[:-(N-1)]))


Measured memory_bytes: 13960
#include <iostream>
#include <string>
using namespace std;
#define B

#ifdef B

int main(void)
{
	string instr;
	cin >> instr;
	string ans;
	int leng = instr.size();
	for (size_t i = 0; i < leng; i = i+2)
	{
		ans += instr[i];
	}
	cout << ans << endl;
	return 0;
}

#endif // B

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

#define ll long long
#define f first
#define s second

int main() {
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++) {
        if (s == t) {
            cout << "Yes" << endl;
            return 0;
        }
        string c;
        c += s[s.size() - 1];
        s.erase(s.end() - 1);
        s.insert(0, c);
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define mod 998244353
#define mad(a,b) a=(a+b)%mod
#define mul(a,b) a=(a*b)%mod
#define N 5000010
ll fac[N],inv[N],ivf[N];
ll C(ll n,ll k){
    if(n<k)return 0;
    return fac[n]*ivf[n-k]%mod*ivf[k]%mod;
}
ll H(ll n,ll k){
    //if(k==0)return 1;
    return C(n+k-1,k);
}
ll P(ll n,ll k){
    return fac[n]*ivf[n-k]%mod;
}
ll po(ll x,ll y){
    ll res=1;
    for(;y;y>>=1){
	if(y&1)res=res*x%mod;
	x=x*x%mod;
    }
    return res;
}

int main(){
    fac[0]=ivf[0]=inv[1]=1;
    for(int i=1;i<N;i++){
	if(i>1)inv[i]=(mod-mod/i*inv[mod%i]%mod)%mod;
	fac[i]=fac[i-1]*i%mod;
	ivf[i]=ivf[i-1]*inv[i]%mod;
    }
     ll n,m; cin>>n>>m;
     ll ans=0;
     for(ll p=0;p<=m;p++){
	 if((3*m-p)%2==1)continue;
	 ll cur=H(n,(3*m-p)/2)*C(n,p);
	 mad(ans,cur);
	 //cout<<cur<<endl;
     }
     mad(ans,-n*H(n,m-1));
     if(ans<0)ans+=mod;
     cout<<ans<<endl;
    return 0;
}


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

int main(){
	ll a;
  	double b;
  	cin >> a >> b;
  
  	int bb = b*100 + 0.1; //誤差を消すため小数を足す
  	a = a * bb / 100;
  	cout << a << endl;
}

Measured memory_bytes: 3688
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <assert.h>
#include <sys/time.h>
#include <fstream>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define REP(i,n)  FOR(i,0,n)
#define each(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define deb(x) cerr << #x << " = " << (x) << " , ";
#define debl cerr << " (L" << __LINE__ << ")"<< endl;
#define sz(s) (int)((s).size())


#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define MP(x,y) make_pair((x),(y))

double pi=3.14159265358979323846;

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

template<typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& z){
	os << "[ ";
	REP(i,z.size())os << z[i] << ", " ;
	return ( os << "]" << endl);
}

template<typename T> std::ostream& operator<<(std::ostream& os, const set<T>& z){
	os << "set( ";
	EACH(p,z)os << (*p) << ", " ;
	return ( os << ")" << endl);
}

template<typename T,typename U> std::ostream& operator<<(std::ostream& os, const map<T,U>& z){
	os << "{ ";
	EACH(p,z)os << (p->first) << ": " << (p->second) << ", " ;
	return ( os << "}" << endl);
}

template<typename T,typename U> std::ostream& operator<<(std::ostream& os, const pair<T,U>& z){
	return ( os << "(" << z.first << ", " << z.second << ",)" );
}

double get_time(){
	struct timeval tv;
	gettimeofday(&tv, NULL);
	return tv.tv_sec + tv.tv_usec*1e-6;
}

typedef unsigned int uint32_t;
struct RND{
	uint32_t x;
	uint32_t y;
	uint32_t z;
	uint32_t w;
	RND(){
		x=123456789;
		y=362436069;
		z=521288629;
		w=88675123;
	}
	void init(int seed){
		x=123456789;
		y=362436069;
		z=521288629;
		w=seed+100;
		REP(i,10)get();
	}
	uint32_t get(){
		uint32_t t;
		t=x^(x<<11);
		x=y;y=z;z=w;
		w=(w^(w>>19))^(t^(t>>8));
		return w;
	}
};
RND rnd;

void _main(istream &inp){
	vl seq;
	int n;
	inp >> n;
	rep(j,n){
		int x;
		inp >> x;
		seq.push_back(x);
	}
	int c = 10000;
	int cnt = 0;
	//debug(seq);
	FOR(i,1,n){
		if(seq[i]==seq[i-1]){
			seq[i]=c;
			c--;
			cnt++;
		}
	}
	//debug(seq);
	cout << cnt << endl;
	while(true){
		break;
	}

}

int main(){
	if(0){
		ifstream ifs("test.txt");
		_main(ifs);
	}
	else{
		_main(cin);
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<stdio.h>
#include<math.h>
#include<stdio.h>
#include<complex>
using namespace std;

#define rep(i,n) for(long long i = 0; i < n; i++)

typedef long long ll;
typedef unsigned long long int ulli;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pii;

const ll INF = ll(1e18) + 1;
const int intINF = 1e9 * 2 + 3;
//--------------------------------------------------
ulli powN(ulli num,ulli i) {
	return (i > 1) ? num : powN(num * 9, i - 1);
}

ulli gcd(ulli a, ulli b) {return (b <= 0) ? a : gcd(b, a % b);}
ulli lcm(ulli a, ulli b) {return a * b / gcd(a, b);}

bool isPrime(int n)
{
	if (n <= 3)return n > 1;
	if (n % 2 == 0)return false;
	if (n % 3 == 0)return false;
	for (int i = 5; i * i < n; i += 6) {
		if (n % i == 0 || n % (i + 2) == 0) { return false; }
	}
	return true;
}
//---------------------------------------------------


ulli func(int num) {
	if (num < 2) {
		return 1;
	}
	else if (num >= 2) {
		return num * func(num - 2);
	}
}

void Main()
{
	ll n;
	cin >> n;
	ll sum = n * (n + 1) / 2;
	ll fizz = 3 * (n / 3) * (n / 3 + 1) / 2;
	ll buzz = 5 * (n / 5) * (n / 5 + 1) / 2;
	ll fizzBuzz = 15 * (n / 15) * (n / 15 + 1) / 2;
	ll ans = sum - fizz - buzz + fizzBuzz;
	cout << ans << endl;
}


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

Measured memory_bytes: 3628
let ans, n = ref 1, read_int ()
let us, a_s = Array.(make (n + 1) 0, init n @@ fun _ -> Scanf.scanf " %d" (+) 0)
let _ = us.(0) <- 3; Array.iter (fun a -> ans := !ans * us.(a) mod 1000000007; us.(a) <- us.(a) - 1; us.(a + 1) <- us.(a + 1) + 1) a_s; Printf.printf "%d\n" !ans

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

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

	string output = "Three";
	string arare;
	for (int i=0; i<N; i++){
		cin >> arare;
		if (arare == "Y") output = "Four";

	}
	printf("%s\n", output.c_str());
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  string s;
  cin >> s;
  int l = 0, r = 0;
  int n = s.size();
  vector<int> ans(n,0);
  while (l < n) {
    while (r < n && s[r] == 'R') r++;
    int m = r;
    int R = r - l;
    while (r < n && s[r] == 'L') r++;
    int L = r - m;
    ans[m-1] = (R+1)/2+L/2;
    ans[m] = (L+1)/2+R/2;
    l = r;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1488
l = input().split(" ")
a = int(l[0])
b= int(l[1])
c= int(l[2])
p=[]
for i in range(min(a,b)):
    if(a%(i+1)==0 and b%(i+1)==0):
        p.append(i+1)
        continue
p.reverse()
print(p[c-1])


Measured memory_bytes: 3060
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int[] input = io.r<int>(' ');
        int[][] nm = io.r<int>(input[0], ' ');
        int[][] ml = io.r<int>(input[1], ' ');

        for (int i = 0; i < input[0]; i++)
        {
            for (int j = 0; j < input[2]; j++)
            {
                long num = 0;
                for (int k = 0; k < input[1]; k++)
                {
                    num += nm[i][k] * ml[k][j];
                }
                io.w(num, false);
                if (j < input[2] - 1) { io.w(" ", false); }
                else { io.w(""); }
            }
        }
        io.wflush();
    }
}

namespace LIB
{
    public class io
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T r<T>() { return util.parse<T>(r()); }
        public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); }
        public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; }
        public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; }
        private static string r() { return Console.ReadLine(); }
        public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } }
        public static void wflush() { Console.Write(S.ToString()); S.Length = 0; }
    }
    public class util
    {
        public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class memo<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public memo() { R = new Dictionary<Key, Result>(); }
        public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}

Measured memory_bytes: 10580
#include<stdio.h>
main (){
  int i,l,a[256],b;
  for(i=0;i<10;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<9;i++){
    for(l=9;l>i;l--){
      if(a[l]>a[l-1]){
	b=a[l];
	a[l]=a[l-1];
	a[l-1]=b;
      }
    }
  }
  for(i=0;i<3;i++){
    printf("%d\n",a[i]);
  }
  return 0;
}

Measured memory_bytes: 0
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	int n;
	cin>>n;
	vector<int> a(n);
	rep(i,n) cin>>a[i];
	int ans=0;
	vector<int> S(n+1);
	S[0]=1;
	rep(i,n){
		if(i==0) S[i+1]=a[i];
		else S[i+1]=S[i]+a[i];
		if(S[i+1]*S[i]>0){
			ans+=abs(S[i+1])+1;
			S[i+1]=(S[i]>0)?-1:1;
		}
		if(S[i+1]==0){
			ans+=1;
			S[i+1]+=(S[i]>0)?-1:1;
		}
		//cout<<S[i+1]<<" "<<ans<<endl;
	}
	int ans2=0;
	S[0]=-1;
	rep(i,n){
		if(i==0) S[i+1]=a[i];
		else S[i+1]=S[i]+a[i];
		if(S[i+1]*S[i]>0){
			ans2+=abs(S[i+1])+1;
			S[i+1]=(S[i]>0)?-1:1;
		}
		if(S[i+1]==0){
			ans2+=1;
			S[i+1]+=(S[i]>0)?-1:1;
		}
		//cout<<S[i+1]<<" "<<ans<<endl;
	}
	cout<<min(ans,ans2)<<endl;
}

Measured memory_bytes: 1792