akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//---------------------------------------------------------------------------
ll B[600][600];
//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll n,m,Q;cin>>n>>m>>Q;

    for(ll i=0;i<m;i++){
        ll l,r;cin>>l>>r;
        B[l][r]++;
    }
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=n;j++){
            B[i][j+1]+=B[i][j];
        }
    }
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=n;j++){
            B[j+1][i]+=B[j][i];
        }
    }
    for(ll i=0;i<Q;i++){
        ll p,q;cin>>p>>q;
        cout<<B[q][q]+B[p-1][p-1]-B[p-1][q]-B[q][p-1]<<endl;
    }
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


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

int main(){
  int x, y, n, cnt = 0;
  cin >> x >> y >> n;
  for (int i = x; i <= y; i++) {
    if (n % i == 0) {
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  int dp[n];
  dp[1]=abs(a[1]-a[0]);
  dp[2]=min(abs(a[2]-a[0]),abs(a[1]-a[0])+abs(a[2]-a[1]));
  for(int i=3;i<n;i++)
  {
    int x=abs(a[i]-a[i-1]);
    int y=abs(a[i]-a[i-2]);
    dp[i]=min(dp[i-1]+x,dp[i-2]+y);
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
int main()
{
    int n,m,x,i,c1=0,c2=0,a[100],min;
    scanf("%d %d %d",&n,&m,&x);
   for(i=0;i<m;i++)
   {
       scanf("%d",&a[i]);
       if(a[i]<x)
        c1++;
       else
        c2++;
   }
   if(c1<c2)
    min=c1;
   else
    min=c2;
   printf("%d\n",min);
    return 0;
}


Measured memory_bytes: 128
(let ((n (read))
      (q (read))
      (s (read-line))
      (a (make-array 2 :element-type 'integer
                       :initial-element 0
                       :adjustable t
                       :fill-pointer 2))
      (ac 0))
     (loop for i from 1 below n do
           (if (and (eq (char s (1- i)) #\A) (eq (char s i) #\C)) (incf ac))
           (vector-push-extend ac a))
     (loop repeat q do
           (format t "~A~%" (* -1 (- (aref a (read)) (aref a (read)))))))


Measured memory_bytes: 60260
# https://atcoder.jp/contests/hitachi2020/submissions/10704509

def main():
    import sys
    input = sys.stdin.readline

    inf = 1 << 30
    L = 30

    N, T = map(int, input().split())

    ps = []
    coef_0 = []
    for _ in range(N):
        a, b = map(int, input().split())
        if a == 0:
            coef_0.append(b + 1)
        else:
            ps.append((a, b))  # namedtupleやめた,coef,const

    ps.sort(key=lambda p: p[0] / (p[1] + 1), reverse=True)
    coef_0.sort()

    dp = [inf] * (L + 1)
    dp[0] = 0
    for coef, const in ps:
        for visited in reversed(range(L)):
            dp[visited + 1] = min(
                dp[visited + 1],
                (dp[visited] + 1) * (coef + 1) + const
            )

    def accumulate(a):
        s = 0
        yield s  # start=x->0
        for x in a:
            s += x
            yield s

    *acc, = accumulate(coef_0)

    ans = {0}
    cnt = len(acc) - 1
    for visited, consumption_time in enumerate(dp):
        rest = T - consumption_time
        if rest < 0: break  # le->lt,continue->break,restは狭義単調減少
        while cnt > 0 and acc[cnt] > rest:  # bisect_right->しゃくとり
            cnt -= 1
        ans.add(visited + cnt)
    print(max(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 73564
N,mod=map(int,input().split())

DP=[[0]*(N+5) for i in range(3*N+5)]
DP[0][0]=1

for i in range(3*N):
    for j in range(N+1):
        DP[i][j]%=mod
        DP[i+1][j]+=DP[i][j]
        DP[i+2][j+1]+=((3*N-i)-1)*DP[i][j]
        DP[i+3][j+1]+=((3*N-i)-1)*((3*N-i)-2)*DP[i][j]

ANS=0
for i in range(N+1):
    ANS+=DP[3*N][i]
print(ANS%mod)

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

int main(){
  string input;
  vector<char> q;
  cin>>input;
  for(int i=0;i<input.length();i++){
    if('B'==input[i]){
      if(true!=q.empty()){
      	q.pop_back();
      }
    }else{
      q.push_back(input[i]);
    }
  }
    for(int i=0;i<q.size();i++){
      cout<<q[i];
    }
  return 0;
}

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

#define N 200010
#define MAX 1000000000000000000

#include <stdio.h>

int main (void) {
  char s[4];
  int i, j = 0, max = 0;

  scanf("%s", s);

  for (i = 0; i < 3; i++) {
    if (s[i] == 'R') {
      j++;
    } else {
      if (j > max) max = j;
      j = 0;
    }
  }

  if (j > max) max = j;

  printf("%d", max);

  return 0;

}



Measured memory_bytes: 1680
<?php
error_reporting(0);
//$N = explode(" ",trim(fgets(STDIN)));
//list($N,$M) = explode(" ",trim(fgets(STDIN)));
$N=trim(fgets(STDIN));
for($i=0;$i<$N;$i++) {
  $s[]=trim(fgets(STDIN));
}
$M=trim(fgets(STDIN));
for($i=0;$i<$M;$i++) {
  $t[]=trim(fgets(STDIN));
}
$res = 0;
$S = array_count_values($s);
$T = array_count_values($t);
foreach($S as $k=>$v) {
  $res = max($v - $T[$k],$res);
}
printf("%d\n",$res);


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

#define pb push_back
#define vi vector < int >
#define ii pair < int, int >
#define vii vector < pair < int, int > >
#define vvi vector < vector < int > >
#define ll long long
#define X first
#define Y second
#define mp make_pair
#define FOR( i, lo, hi ) for( int i = (lo);i < (hi);i++ )
#define DFOR( i, hi, lo ) for( int i = (hi);i >= (lo);i-- )
#define pqueue priority_queue

using namespace std;

const long long int MOD = 1e9 + 7;

ll REM( ll a )
{
	a %= MOD;
	if ( a < 0 )
	   a += MOD;
	return a;
}

ll ADD( ll a, ll b )
{
	return REM( REM( a ) + REM( b ) );
}

ll SUB( ll a, ll b )
{
	return REM( REM( a ) - REM( b ) );
}

ll MUL( ll a, ll b )
{
	return REM( REM( a ) * REM( b ) );
}

ll POT( ll n, ll k )
{
	if ( k == 0 )
		return 1;

	ll ret = POT( n, k / 2 );
	ret = MUL( ret, ret );

	if ( k % 2 )
		return MUL( ret, n );
	return ret;
}

ll DIV( ll a, ll b )
{
	return MUL( a, POT( b, MOD - 2 ) );
}

bool isPrime( ll x )
{
	for ( ll i = 2;i <= sqrt( x ); i++ )
		if ( x % i == 0 )
			return false;
	return true;
}

string s;
int n;

int main()
{
	cin >> n >> s;
	FOR( i, 0, ( int )s.size() )
	{
		s[ i ] = ( char )( ( ( int )s[ i ] - 65 + n ) % 26 + 65 );
	}
	cout << s << "\n";
	return 0;	
}


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
    n, m = map(int, input().split())
    uf = UnionFind(n)

    for _ in range(m):
        a, b = map(int, input().split())
        uf.union(a-1, b-1)
    
    ans = 0
    for i in range(n):
        ans = max(ans, uf.size(i))
    
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;
const int N = 1e5 + 5;
int par[N];

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

void merge(int a, int b) {
    a = getpar(a);
    b = getpar(b);
    if (a == b) return;
    par[a] = b;
}

vector<int> adj[N];
int val[N];

void dfs(int u, int p) {
    val[u] = val[p] ^ 1;
    for (auto v:adj[u]) {
        if (v == p) continue;
        dfs(v, u);
    }
}

int main() {
    //freopen("in.txt", "rt", stdin);
    int n;
    scanf("%d", &n);
    int a, b, c;
    for (int i = 1; i <= n; ++i) par[i] = i;
    vector<pair<int, int>> vec;
    for (int i = 1; i < n; ++i) {
        scanf("%d %d %d", &a, &b, &c);
        if (c % 2) vec.emplace_back(a, b);
        else merge(a, b);
    }
    for (auto E:vec) {
        a = getpar(E.first);
        b = getpar(E.second);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    dfs(getpar(1), 0);
    for (int i = 1; i <= n; ++i) printf("%d\n", val[getpar(i)]);
}

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

int main(){
    string word;
    stack<int> S;
    int a,b;
    while(cin>>word){ //??\??????????????????????????????
        if(word=="+"){
            a=S.top();
            S.pop();
            b=S.top();
            S.pop();
            S.push(a+b);
        }
        else if(word =="-"){
            a=S.top();
            S.pop();
            b=S.top();
            S.pop();
            S.push(b-a);
            
        }
        else if(word == "*"){
            a=S.top();
            S.pop();
            b=S.top();
            S.pop();
            S.push(a*b);
        }
        else{
            S.push(stoi(word));
        }
    }
    cout<<S.top()<<"\n";
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REP(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define REP1(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Int = long long;
 
//INT_MAX = 2147483647;
//LLONG_MAX = 9223372036854775807;
//ULLONG_MAX = 18446744073709551615;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;
 
//少数点表示
//cout << std::fixed << std::setprecision(14) << 値
 
int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    
    int n;
    cin >> n;
    vector<ll> l(n);
    rep(i,n) cin >> l[i];
    sort(l.rbegin(),l.rend());
    ll goukei=0;
    rep1(i,1,n){
        goukei += l[i];
    }
    
    cout << ((goukei>l[0])?"Yes":"No") <<endl;
    
    return 0;
    
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> ans(n, 0);
    ans[0] = 1;
    
    vector<int> num(n, 1);
    
    rep(i, m) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        
        num[x]--; num[y]++;
        
        if (ans[x]) ans[y] = 1;
        if (num[x] == 0) ans[x] = 0;
    }
    
    int a = 0;
    rep(i, n) a += ans[i];
    out(a);
}
int main() {
    solve();
}


Measured memory_bytes: 1024
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn cango(t: i32, x: i32, y: i32) -> bool {
    //println!("{}, {}, {}", t, x, y);
    let xab = if x >= 0 { x } else { -x };
    let yab = if y >= 0 { y } else { -y };
    if xab + yab > t {
        return false
    }

    (xab + yab) % 2 == t % 2
}

fn main() {
    let n = read::<i32>();
    let mut v = vec![];
    for _ in 0..n {
        v.push(read_vec::<i32>());
    }

    let mut vs: Vec<(i32, i32, i32)> = vec![];
    for (i, vi) in v.iter().enumerate() {
        if i == 0 {
            vs.push((vi[0], vi[1], vi[2]));
        } else {
            vs.push((vi[0]-v[i-1][0], vi[1]-v[i-1][1], vi[2]-v[i-1][2]));
        }
    }

    let mut retb = true;
    for vi in vs {
        if !cango(vi.0, vi.1, vi.2) {
            retb = false;
            break;
        }
    }
    if retb {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 10104
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s; cin >> s;
	if(s.size() < 4) cout << "No" << endl;
	else {
		if(s.substr(0,4) == "YAKI") cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3628
n= int(input())
s = n + (0 if n%2 == 1 else 1)
ans = []
for i in range(n-1):
  for j in range(i+1,n):
    if i+j+2 != s:
      ans.append(str(i+1)+" "+str(j+1))
print(len(ans))
for t in ans:
  print(t)

Measured memory_bytes: 3588
#include<iostream>
#include<cstdio>
#include<map> 
using namespace std;
map<long long,long long>dp;
const long long mod=1e9+7;
long long DP(long long x)
{
	if(dp[x]) return dp[x];
	else
	{
		return dp[x]=(DP(x/2)+DP((x-1)/2)+DP((x-2)/2))%mod;
	}
}
int main()
{
	long long n;
	cin>>n;
	dp[0]=1;dp[1]=2;
	cout<<DP(n);
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <climits>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N,D,ans=0,sum=0;
	cin>>N>>D;
	int tmp=2*D+1;
	while (1){
		sum+=tmp;
		ans++;
		if(sum>=N){
			break;
		}
	}
	cout<<ans<<endl;
	
	return 0;
}

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

int main() {
	int N , K;
	cin >> N >> K;
	int x[N];
	int Min = 1000000000;
	for (int i = 0;i < N;i++) {
		cin >> x[i];
	}
	for (int i = 0;i < N - K + 1;i++) {
		int a = Min;
		Min = min({Min,x[K-1+i]-x[i]+abs(0-x[i]),x[K-1+i]-x[i]+abs(0-x[K-1+i])});
	}
	cout << Min;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

const int MAX_V=1000;
const int INF=1e18;
struct edge{ int to,cost; };

int V,E,dist[MAX_V];
vector<edge> G[MAX_V];

bool bellman_ford(int s)
{   
    REP(i,V) dist[i]=INF;
    dist[s]=0;

    REP(cnt,V) REP(i,V){
        if(dist[i]==INF) continue;
        for(edge e:G[i]){
            if(dist[e.to]>dist[i]+e.cost){
                dist[e.to]=dist[i]+e.cost;
                if(cnt==V-1) return true;
            }
        }
    }
    return false;
}

signed main()
{   
    int r; cin>>V>>E>>r;
    REP(i,E){
        int a,b,c; cin>>a>>b>>c;
        G[a].push_back((edge){b,c});
    }
    if(bellman_ford(r))
        cout<<"NEGATIVE CYCLE"<<endl;
    else{
        REP(i,V){
            if(dist[i]==INF) cout<<"INF"<<endl;
            else cout<<dist[i]<<endl;
        }
    }
}



Measured memory_bytes: 3180
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (ll)1e9 //10^9:∞
#define LLINF (ll)1e12
#define MOD (ll)(1e9+7) //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)
#define endl "\n"

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	int n, k; cin >> n >> k;
	vector<int> x(n);
	REP(i, n) cin >> x[i];
 
	int res = INF;
	REP(i, n - k + 1) {

		int left = abs(x[i]) + abs(x[k-1+i] - x[i]);
		int right = abs(x[k-1+i]) + abs(x[k-1+i] - x[i]);
		res = min(res, min(left, right));
	}
	if (n == 1) res = abs(x[0]);
	cout << res << endl;






	return 0;
}


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

int main(){
	int h,w;
  	cin >> h >>w;
  	vector<string> vec(h);
  	for (int j=0;j<h;j++){
  		cin >> vec.at(j);
    }
  for (int i=0;i<w+2;i++)cout << "#";
  cout <<endl;
  for (int j=0;j<h;j++)cout << "#" << vec.at(j) << "#" <<endl;
  for (int i=0;i<w+2;i++)cout << "#";
  cout <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>
#include <cassert>

using namespace std;
typedef long long ll;

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

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll N;
  cin>>N;
  if(N%2==1){
    cout<<0<<endl;
  }else{
    ll ans=0;
    for(ll i=10;i<INFLL;i*=5){
      ans+=N/i;
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int N, P;
map<long long, long long> inv_fact;
long long inv_factorial(long long x){
    if (inv_fact.count(x)){
        return inv_fact[x];
    }
    long long p=P-2;
    long long ret=1;
    long long tmp=x;
    while(p>0){
        if(p%2==1)ret=ret*tmp%P;
        tmp=tmp*tmp%P;
        p/=2;
    }
    inv_fact[x]=ret;
    return ret;
}

template<typename T>
void cout_vec(vector<T> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    cin >> N >> P;
    string S;
    cin >> S;

    ll ans=0;
    if(P==2 || P==5){
        for(int i=0; i<N; i++){
            if((S[i]-'0')%P==0){
                ans+=(ll) (i+1);
            }
        }
        cout << ans << endl;
        return 0;
    }

    vector<ll> vec(N+1,0);
    vector<ll> cnt(P,0);
    cnt[0]=1;
    ll fact=1;
    for(int i=0; i<N; i++){
        vec[i+1]=(ll) (vec[i]+(S[i]-'0')*fact)%P;
        fact*=inv_factorial(10);
        fact%=P;
        cnt[vec[i+1]]++;
    }
    for(int i=0; i<P; i++){
        ans+=cnt[i]*(cnt[i]-1)/2;
    }
    //cout_vec(vec);
    cout << ans << endl;
}

Measured memory_bytes: 2180
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string> 
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }


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

	int n;
	cin >> n;
	vvl table(10, vl(10, 0));
	reps(i, n)
	{
		string s = to_string(i);
		int a = s.front()-'0';
		int b = s.back()-'0';
		table[a][b]++;
	}
	ll ans = 0;
	reps(i, 9)reps(j, 9)ans += table[i][j]* table[j][i];
	co(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    cin >> N;
    for (int i = 0; i <= N; i += 7) {
        if ((N-i) % 4 == 0) {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
}

Measured memory_bytes: 256
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

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

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int a,b;cin>>a>>b;
    int result = 0;
    
    REP(i,2){
        if(a>b){
            result+=a;
            a--;
        }
        else{
            result+=b;
            b--;
        }
    }

    cout<<result<<endl;


	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>

using namespace std;

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

void swap(int &A, int &B) {
    int T = A;
    A = B;
    B = T;
}

int main() {
    int A, B, K;
    cin >> A >> B >> K;

    if (A > B) {
        swap(A, B);
    }

    vector<int> v;
    REP(1, i, A + 1) {
        if (A % i == 0 && B % i == 0) {
            v.push_back(i);
        }
    }

    // for (vector<int>::iterator it = v.begin(); it != v.end(); ++it) {
    //     cout << (*it) << endl;
    // }

    printf("%d\n", v[v.size() - K]);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>
#include <bitset>
#include <stack>

using namespace std;
typedef long long ll;

int main() {
  string s;
  cin >> s;
  if (s[0] == s[s.length() - 1]) {
    if(s.length() % 2 == 0) cout << "First" << endl;
    else cout << "Second" << endl;
  } else {
    if(s.length() % 2 == 0) cout << "Second" << endl;
    else cout << "First" << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<vector<int>> cnts(n + 1, vector<int>(2, 0));

    for (int i = 0; i < n; ++i) {
        cnts[i + 1] = cnts[i];
        cnts[i + 1][s[i] == 'E'] += 1;
    }

    int res = n;
    for (int i = 0; i < n; ++i) {
        int cnt = 0;
        cnt += cnts[i][0];
        cnt += cnts[n][1] - cnts[i + 1][1];
        res = min(res, cnt);
    }

    cout << res << '\n';
    
    return 0;
}

Measured memory_bytes: 16916
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,mmx,avx,tune=native")
#include "bits/stdc++.h"
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
#define fst first
#define snd second
const int UNDEF = -1;
const int INF=1<<30;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;typedef vector<ll> vll;typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;
#ifdef ONLINE_JUDGE
#define assert(...) /* nothing */
#endif
#define DEBUG_CAT
#ifdef DEBUG_CAT
#define dbg(...)   printf( __VA_ARGS__ )
#else 
#define dbg(...)   /****nothing****/
#endif
// mt19937 rng; rng.seed(std::chrono::high_resolution_clock::now().time_since_epoch().count());
// template<typename T> int bins(vector<T> &v, T key) {int imin=0,imax=v.size();while(imin<imax) {int imid=(imin+imax)>>1;if (v[imid]<key) imin=imid+1;else imax=imid;}return imin;}


void solve(string s, long long k){
	ll a=0;
	ll n=s.length();
	char lasta=s[n-1];
	{
		for (ll i=1;i<n;i++) {
			if (s[i]==s[i-1]) {
				if (i==n-1) lasta='?';
				a++;
				i++;
			}
		}
	}
	ll b=0;
	char lastb=s[n-1];
	{
		for (ll i=0;i<n;i++) {
			if (i==0||s[i]==s[i-1]) {
				if (i==n-1) lastb='?';
				b++;
				i++;
			}
		}
	}
	//cout<<a<<":"<<b<<endl;
	//cout<<lasta<<lastb<<endl;
	ll ans=-1;
	if (lasta!=s[0]) {
		ans=a*k;
	} else {
		ll an=-1,bn=-1;
		if (lastb!=s[0]) {
			an=(k+1)/2,bn=k-an;
		} else {
			an=1; bn=k-an;
		}
		assert(an>=0&&bn>=0&&an+bn==k);
		ans=an*a+bn*b;
	}
	assert(ans>=0);
	cout<<ans<<endl;
}

int main(){	
	string S;
	long long K;
	cin >> S;
	scanf("%lld",&K);
	solve(S, K);
	return 0;
}



Measured memory_bytes: 256
N = int(input())
lst = []

for i in range(N):
    toshi, ten = map(str, input().split())
    lst.append((toshi,int(ten),i+1))

for i in range(N):
    flag = 0
    for j in range(N-1):
        if lst[j][0] > lst[j+1][0]:
            lst[j] ,lst[j+1] = lst[j+1],lst[j]
            flag = 1
    if flag == 0:break

for i in range(N):
    flag = 0
    for j in range(N-1):
        if lst[j][0] == lst[j+1][0]:
            if lst[j][1] < lst[j+1][1]:
                lst[j] ,lst[j+1] = lst[j+1],lst[j]
                flag = 1
    if flag == 0:break
for lst in lst:
    print(lst[2])


Measured memory_bytes: 3064
import itertools
import numpy as np
def main():
  N = int(input())
  ch = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
  for i in range(N):
    s = str(input())
    if s[0] in ch:
      ch[s[0]] += 1
  ch =  ch.values()
  ans = 0
  for i in itertools.combinations(ch, 3):
    ans += np.prod(i)
  print(ans)

if __name__ ==  "__main__":
  main()

Measured memory_bytes: 12400
#include<iostream>
using namespace std;
long int gcd(long int a,long int b){
  while(b){
    a=a%b;
    swap(a,b);
  }
  return a;
}

int main(){
  int t; cin >> t;
  for(int i;i<t;i++){
    long int a,b,c,d; cin >> a >> b >> c >> d;
    int ans;
    if(a<b || d<b) ans=0;
    else{
    long int g;
    int f;
      g=gcd(b,d);
      f=(a%g > c%g)?1:0;
      a/=g;
      b/=g;
      c/=g;
      d/=g;
      c-=f;
      ans=(b <= c+1)?1:0;
    }
    cout << (ans?"Yes\n":"No\n");
  }
}


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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll A, B, C, K; cin >> A >> B >> C >> K;
    ll res = 0;
    res = min(K, A);
    if (res == K) { // KがA以下の場合全部1とるのが最大
        cout << res << endl;
    }
    else {
        ll rest = max(0LL, K - A - B);
        if (rest == 0) { // K = A + B(以下)
            cout << res << endl;
        }
        else { // Cをrest個
            cout << res - rest << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3636
from collections import *
from heapq import *
from itertools import *
from fractions import gcd

from decimal import *
import copy
from bisect import *
import time
import sys
import math
sys.setrecursionlimit(10**7)
N=int(input())
A=list(map(int,input().split()))
count=0
for a in A:
    while a%2==0:
        a//=2
        count+=1
print(count)


Measured memory_bytes: 68204
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007



int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a;
  cin>>a;
  int fl=0;
  for(int i=1;i<10;i++)
  {
    if(a%i==0 && (a/i)<10)
    fl=1;
  }
  if(fl==0)
  cout<<"No"<<"\n";
  else
  cout<<"Yes\n";
  
  return 0;
}


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

using namespace std;

int N, W;
int v[1023], w[1023];
int M[1023][10001];  //sinamonobanngou  omosajougenn

int main()
{
    cin >> N >> W;
    for (int i = 0; i < N; i++) {
        cin >> v[i] >> w[i];
    }
    M[0][0] = 0;
    for (int i = 1; i <= 1022; i++) {
        M[i][0] = 0;
    }
    for (int i = 1; i <= 10000; i++) {
        M[0][i] = 0;
    }
    for (int i = 1; i <= 10000; i++) {
        for (int j = 1; j <= 1022; j++) {
            if (i < w[j - 1]) {
                M[j][i] = M[j - 1][i];
            } else {
                M[j][i] = v[j - 1] + M[j - 1][i - w[j - 1]] > M[j - 1][i] ? v[j - 1] + M[j - 1][i - w[j - 1]] : M[j - 1][i];
            }
        }
    }
    cout << M[N][W] << endl;
}


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

int main() { 
  long long  l,r;
  cin >> l >> r;
  int ans = 2019;
  bool flag = false;

//  int ml = l % 2019; //cout << "ml:" << ml << endl;
//  int mr = r % 2019; //cout << "mr:" << mr << endl;

//  if (ml == 0 || mr ==0) ans = 0;

 for(long long i=l; i<r; i++){ //ここもlong longじゃないとオバーフローしちゃう。。。

   for(long long j=i+1; j<=r; j++){

     //cout << "i:" << i << endl;
    // cout << "j:" << j << endl;

     int tmp;
     tmp = (i*j) % 2019; 
     //cout << "tmp:" << tmp << endl;

     ans = min(tmp, ans); 
    // cout << "ans:" << ans << endl;

     if(ans == 0) {
       flag = true;
       break;
     }
   }

   if(flag == true) break;

 }

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

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;

class Main{
	public static void main(String[] args){
      	Scanner sc = new Scanner(System.in);
      	int a[][] = new int[3][3];
      	for(int i = 0; i < 3; i++)
          for(int j = 0; j < 3; j++)
            a[i][j] = sc.nextInt();
      
      	boolean flag = true;
      	for(int i = 0; i < 2; i++){
      		if((a[0][i] - a[0][i+1] != a[1][i] - a[1][i+1] || a[1][i] - a[1][i+1] != a[2][i] -a[2][i+1])) 
              flag = false;
    	}
      	for(int i = 0; i < 2; i++){
      		if((a[i][0] - a[i+1][0] != a[i][1] - a[i+1][1] || a[i][1] - a[i+1][1] != a[i][2] -a[i+1][2])) 
              flag = false;
    	}
      
      	if(flag)
          System.out.println("Yes");
      	else
          System.out.println("No");
    }
  
}

Measured memory_bytes: 22612
#include <iostream>
    #include <vector>
     
    using namespace std;
     
    int main() {
        int n; double d, x;
        cin >> n >> d >> x;
        vector<double> p(n+1, 0), psm(n+2, 0);
        for (int i = 1; i <= n; i++) {
            p[i] = p[i-1] + 0.5/i;
        }
     
        double ans = 0;
        for (int i = 0; i < n; i++) {
            ans += (p[i+1]*d + p[n-i]*(d+x) );
            d += 2*x;
        }
        printf("%.20lf\n", ans);
        
        return 0;
    }


Measured memory_bytes: 3328
import sys
input = sys.stdin.readline
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

AB = []
AC = []
BC = []
for a in A:
    for b in B:
        AB.append(a+b)
    for c in C:
        AC.append(a+c)
for b in B:
    for c in C:
        BC.append(b+c)
AB.sort(reverse=True)
AC.sort(reverse=True)
BC.sort(reverse=True)

import heapq
hq = []
for x in AB[:K]:
    for c in C:
        heapq.heappush(hq, -x-c)
for x in BC[:K]:
    for a in A:
        heapq.heappush(hq, -x-a)
for x in AC[:K]:
    for b in B:
        heapq.heappush(hq, -x-b)

ans = []
for _ in range(K):
    ans.append(-heapq.heappop(hq))
    heapq.heappop(hq)
    heapq.heappop(hq)
print(*ans, sep='\n')

Measured memory_bytes: 309908
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
	string S;
	cin >> S;
	int a, b;
	a = stoi(S) / 100;
	b = stoi(S) % 100;
	if (0 < a && a < 13) {
		if (0 < b && b < 13) cout << "AMBIGUOUS";
		else cout << "MMYY";
	}
	else if (0 < b && b < 13) cout << "YYMM";
	else cout << "NA";
	cout << endl;




	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		String str = scanner.next();
		String order,change;
		int Q = scanner.nextInt();
		int a,b;

		for(int loop = 0; loop < Q; loop++){
			order = scanner.next();

			if(order.equals("print")){

				a = scanner.nextInt();
				b = scanner.nextInt();

				print(str,a,b);

			}else if(order.equals("reverse")){

				a = scanner.nextInt();
				b = scanner.nextInt();

				str = reverse(str,a,b);

			}else{

				a = scanner.nextInt();
				b = scanner.nextInt();
				change = scanner.next();

				str = replaceStr(str,a,b,change);
			}
		}
	}

	private static void print(String str,int a,int b){
		String output = str.substring(a, b+1);
		System.out.println(output);
	}

	private static String reverse(String str,int a,int b){

		char work[] = str.toCharArray();

		int num = b-a+1;
		char tmp;

		for(int i = 0; i < num/2; i++){

			tmp = work[a+i];
			work[a+i] = work[b-i];
			work[b-i] = tmp;
		}

		return String.valueOf(work).substring(0, str.length());
	}

	private static String replaceStr(String str,int a,int b,String change){

		char ch[] = change.toCharArray();
		char work[] = str.toCharArray();

		for(int i = a; i <= b; i++){
			work[i] = ch[i-a];
		}

		return String.valueOf(work).substring(0,str.length());
	}
}


Measured memory_bytes: 29604
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/C-RemainderMinimization.py
#
l, r = map(int, input().split())
i_range_min = l
i_range_max = min(l + 2020, r)
# j_range_min = i + 1
# j_range_max = min((i + 1) + 2020, r)
min_mod = (l * r) % 2019

for i in range(i_range_min, i_range_max):
    j_range_min = i + 1
    j_range_max = min((i + 1) + 2020, r + 1)
    for j in range(j_range_min, j_range_max):
        ij_mod = (i * j) % 2019
        # print("i, j : {} {}".format(i, j))
        # print("ij_mod {}".format(ij_mod))
        if ij_mod < min_mod:
            min_mod = ij_mod
        if min_mod == 0:
            break
    else:
        continue
    break


print(min_mod)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

string divide[4] = {"dream", "dreamer", "erase", "eraser"};
bool dp[100010];

int main(){
    string S;
    cin >> S;

    dp[0] = 1;
    for(int i = 0; i < S.size(); ++i) {
        if(dp[i] == 0) continue;
        for(string s : divide) {
            if(S.substr(i, s.size()) == s) {
                dp[i + s.size()] = 1;
            }
        }
    }

    cout << (dp[S.size()] ? "YES" : "NO") << endl;
    return 0;

    return 0;
}

Measured memory_bytes: 3832
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
# @pysnooper.snoop()
#import pysnooper # debug

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


if __name__ == '__main__':
    counter = {
            "AC": 0,
            "WA": 0,
            "TLE": 0,
            "RE": 0,
            }
    n = int(input())
    for _ in range(n):
        s = input()
        counter[s] += 1

    print("AC x " + str(counter["AC"]))
    print("WA x " + str(counter["WA"]))
    print("TLE x " + str(counter["TLE"]))
    print("RE x " + str(counter["RE"]))


    #print('\33[32m' + 'end' + '\033[0m') # debug


Measured memory_bytes: 70460
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    }    

  int main(){
        lint N;
        cin >>N; 
        map<lint,lint> mp;
        rep(i,N){
            lint a;
            cin>>a;
            mp[a]++;
        }
        lint sum=0;
        for(auto x:mp){
            if(x.second%2==0)sum++;
        }
        lint ans=mp.size();
       if(sum%2==1)ans--;
       cout<<ans;

  }
  
  
     
  

Measured memory_bytes: 6528
from itertools import product
from collections import Counter as ct

n, a, b, c = map(int, input().split())
l = [int(input()) for _ in range(n)]

ans = 10 ** 10
for bit in product([0, 1, 2, 3], repeat=n):
    if len(set(bit) - {0}) != 3:
        continue
    tmpa = 0
    tmpb = 0
    tmpc = 0
    for i, j in enumerate(bit):
        if j == 1:
            tmpa += l[i]
        elif j == 2:
            tmpb += l[i]
        elif j == 3:
            tmpc += l[i]
    mp = abs(a - tmpa) + abs(b - tmpb) + abs(c - tmpc)
    tmp = ct(bit)
    for i in range(1, 4):
        mp += max(0, tmp[i] - 1) * 10
    ans = min(ans, mp)
print(ans)

Measured memory_bytes: 3316
n, m = map(int, input().split())
ks = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))

s = []
for i in ks:
    t = 0
    for j in range(1, i[0]+1):
        t += 2**(i[j]-1)
    s.append(t)

pt = 0
for i in range(2**n):
    l = True
    for j in range(m):
        o = bin(i & s[j]).count("1") % 2
        if o != p[j]:
            l = False
            break
    if l: pt += 1

print(pt)

Measured memory_bytes: 3064
//f[i][j]表示在前i个是j的方案数 
#include <iostream>  
#include <cstdio>  
#include <cstring>  
#include <algorithm>  
#include <cmath>  
using namespace std;
int n,p,a[1000];
long long ans,f[1000][3];
int main()
{
	scanf("%d%d",&n,&p);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		a[i]=a[i]%2;
	}
	f[0][0]=1;
	for (int i=1;i<=n;i++)
	{
		for (int k=0;k<=1;k++)
		{
			int pp=k+a[i];
			pp=pp%2;
		for (int j=0;j<i;j++)
		{
			f[i][k]+=f[j][pp];
		}
	    }
	}
	for (int i=0;i<=n;i++)
	{
		//printf("%d %d\n",p,f[i][p]);
		ans+=f[i][p];
	}
	printf("%lld",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll inf = 3e18;
const char sp = ' ';

int N, a[100000];
ll cnt[1 << 20], DP[1 << 20];

ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1)a = a * x%mod;
		x = x * x%mod;
		y /= 2;
	}
	return a;
}



int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	for (int j = 0; j < 20; j++) {
		for (int i = (1 << 20) - 1; i >= 0; i--) {
			if (!(i&(1 << j))) {
				cnt[i] += cnt[i | (1 << j)];
			}
		}
	}
	ll res = 0;
	for (int i = 0; i < (1 << 20); i++) {
		int c = 0;
		for (int j = 0; j < 20; j++) {
			c += ((i >> j) & 1);
		}
		if (c & 1) {
			res -= pw(2, cnt[i]);
		}
		else {
			res += pw(2, cnt[i]);
		}
		res = (res + mod) % mod;
	}
	cout << res << endl;
}


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

using namespace std;

int main(){
	string S;
	int length;
	bool odd_flag = true;
	bool even_flag = true;

	cin >> S;

	length = (int)S.length();

	for(int i = 0; i < length; i+=2){
		if(S.at(i) == 'L'){
			even_flag = false;
		}
	}

	for(int j = 1; j < length; j+=2){
		if(S.at(j) == 'R'){
			odd_flag = false;
		}
	}

	if(odd_flag == true && even_flag == true){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
const int maxn = 3600;

int t, n, m, k, p[maxn];

multiset <int> s;

int main () {
	
	scanf("%d", &t);
	
	printf("%s", t >= 30?"Yes":"No");
	
	return 0;
}
		
		

Measured memory_bytes: 3796
use std::cmp::{min,max};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::VecDeque;
fn main(){
    input!{
        n:i64,
        s:chars,
    }
    let mut black = 0;
    let mut white = s.iter().filter(|&c| *c == '.').count() as i64;
    let mut sum = black + white;
    for c in &s{
        if *c == '.' {
            white -= 1;
        } else {
            black += 1;
        }
        sum = min(sum,white + black);
    }
    println!("{}",sum);
}


Measured memory_bytes: 4352
x,  k, d = map(int, input().split())

if x > 0:
  if x-(k*d)>=0:
    print(abs(x-k*d))
  else:
    a = x//d
    k -= a+1
    res = x-(a+1)*d
    if k%2==0:
      print(abs(res))
    else:
      print(abs(res+d))
elif x < 0:
  if x+(k*d)<=0:
    print(abs(x+k*d))
  else:
    a = abs(x)//d
    k -= a+1
    res = x+(a+1)*d
    if k%2==0:
      print(abs(res))
    else:
      print(abs(res-d))
else:
  if k%2==0:
    print(0)
  else:
    print(d)

Measured memory_bytes: 9184