akhauriyash/Code-Regression huggingface dataset:
module S = Set.Make (struct type t = int * int let compare = compare end)

let () =
    let split s =
        let rec loop i cur flag acc =
            if i = String.length s then ( if flag then cur :: acc else acc) else (
                match flag, s.[i] with
                | true,  ' ' -> loop (i + 1) "" false (cur :: acc)
                | false, ' ' -> loop (i + 1) "" false acc
                | true,  v   -> loop (i + 1) (Printf.sprintf "%s%c" cur v) true acc
                | false, v   -> loop (i + 1) (Printf.sprintf "%s%c" cur v) true acc
            )
        in
        List.map int_of_string (List.rev (loop 0 "" false []))
    in
    let main () =
        let n, k = Scanf.sscanf (read_line ()) "%d %d" (fun n k -> n, k) in
        let v = Array.of_list (split (read_line ())) in
        let calc l r k =
            let rec loop i acc =
                if i = l then acc else loop (i + 1) (v.(i) :: acc)
            in
            let acc = loop 0 [] in
            let rec loop i acc =
                if i = r then acc else loop (i - 1) (v.(i) :: acc)
            in
            let acc = loop (n - 1) acc in
            let l = List.sort compare acc in
            let rec drop i list =
                if i = 0 then list else
                    match list with
                    | [] -> []
                    | hd :: tl -> if hd < 0 then drop (i - 1) tl else (hd :: tl)
            in
            List.fold_left (+) 0 (drop k l)
        in
        let rec loop k mx sets =
            if k < 0 then mx else
                let mx, next =
                    S.fold (fun (l, r) (mx, next) ->
                        let mx = max mx (calc l r k) in
                        let next = if l <= r then S.add (l+1, r) next else next in
                        let next = if l <  r then S.add (l, r-1) next else next in
                        mx, next) sets (mx, S.empty)
                in
                loop (k - 1) mx next
        in
        let init = S.add (0, n - 1) S.empty in
        let ans = loop k 0 init in
        Printf.printf "%d\n" ans
    in
    main ()

Measured memory_bytes: 4608
//ABC124B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
using namespace std;

int main(){
	string s;
	cin >> s;
	int count1 = 0, count2 = 0;
	int ans;
	for(int i=0;i<s.size();i++){
		if(i%2 == 0){
			if(s.at(i) == '0'){
				count1++;
			}
		}else{
			if(s.at(i) == '1'){
				count1++;
			}
		}
	}
	for(int i=0;i<s.size();i++){
		if(i%2 == 0){
			if(s.at(i) == '1'){
				count2++;
			}
		}else{
			if(s.at(i) == '0'){
				count2++;
			}
		}
	}
	ans = min(count1,count2);
	cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	constexpr Int MOD = 1e9 + 7;
	int N;
	cin >> N;

	Int x = 1, y = 1, z = 1;
	for (int i = 0; i < N; ++i) {
		(x *= 10) %= MOD; 
		(y *= 9) %= MOD;
		(z *= 8) %= MOD;
	}
	cout << (x - 2 * y + z + 2 * MOD) % MOD << "\n";

	return 0;
}


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

ll gcd(ll A, ll B){
  ll R = A % B;
  if (R == 0){
    return B;
  }
  else{
    return gcd(B, R);
  }
}

int main(){
  ll A, B;
  cin >> A >> B;
  
  ll tar = gcd(A, B);
  
  ll ans = 1, num = 2;
  while (tar != 1){
    bool div = false;
    
    if (num > 1000000){
      ans++;
      break;
    }
    
    while (tar % num == 0){
      tar /= num;
      div = true;
    }
    
    if (div == true){
      ans++;
    }
    
    num++;
  }
  
  cout << ans << endl;
}


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

typedef std::vector<long> vl;
typedef std::vector<vl> vvl;

int main()
{
  int N;
  std::cin >> N;
  vvl num_list(10, vl(10, 0));
  int dig = 1;
  for (int i = 1; i <= N; i++)
  {
    if (i / dig == 10) dig *= 10;
    num_list.at(i/dig).at(i%10)++;
  }
  long ans = 0;
  for (int i = 1; i < 10; i++)
  {
    for (int j = 1; j < 10; j++) ans += num_list.at(i).at(j) * num_list.at(j).at(i);
  }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let T = read![i64, i64, i64; N - 1];

    for i in 0..N - 1 {
        let (c1, f1, _) = T[i];
        let mut t = f1 + c1;

        for j in i + 1..N - 1 {
            let (c, f, s) = T[j];
            if t <= f || (t - f) % s == 0 {
                t = max(t, f) + c;
            } else {
                t += s - ((t - f) % s) + c;
            }
        }

        println!("{}", t)
    }

    println!("0");
}


Measured memory_bytes: 4352
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18

ll mod = 1e9+7;
  
int main() {
	// 入力
	string S,T;cin>>S>>T;
    
    
	// 解法
	ll ans = 0;
    REP(i,3){
        if (S[i]==T[i]) ans++;
    }

	//出力
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 #define rep(i,a,b) for (int i=a;i<b;i++)
 #define rep2(i,a,b) for (int i=a;i>=b;i--)
 #define mod 1000000007
 #define INF  1e9+5
 #define f first
 #define se second
 #define endl '\n'
 #define ll long long
 #define ii pair <int,int>
 #define pll pair <ll,ll>
 #define vi vector <int>
 #define vl vector <ll>
 #define vvi vector < vi >
 #define vii vector < ii >
 #define vvii vector < vii >
 #define vll vector < ll >
 #define mi map<int,int>
 #define mll map<ll,ll>
 #define mci map<char,int>
 #define msi map<string,int>
 #define vb  vector <bool>
 #define pb push_back
 #define mk make_pair
 #define sz(a) a.size()
 #define all(a) a.begin(),a.end()
 #define rall(a) a.rbegin(),a.rend()
 #define int long long int
 #define Anurag_Gupta ios_base::sync_with_stdio(false);
#define IIIT_ALLD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
vi fact(1000007);
inline int mdpower(int a,int b)
{
    int res =1;
    while(b)
    {
        if(b&1) res = (res%mod*a%mod)%mod;
        b/=2;
        a = (a%mod*a%mod)%mod;
    }
    return res;
}
inline int power(int a,int b)
{
    int res =1;
    while(b)
    {
        if(b&1) res = (res*a);
        b/=2;
        a = a*a;
    }
    return res;
}

inline void factorial()
{
    fact[0]=1;
    for(int i=1;i<1000007;i++)
        fact[i] = (fact[i-1]%mod*i%mod)%mod;
}

inline int inverse(int a)
{
    return mdpower(a,mod-2);
}
int n;
int h[1000005];
int dp[1000005];
int solve(int idx)
{
	if(idx==n-1)
		return 0;
	if(idx>=n)
		return INF;
	if(dp[idx]!=-1)
		return dp[idx];
	int x = abs(h[idx]-h[idx+1])+solve(idx+1);
	int y = abs(h[idx]-h[idx+2])+solve(idx+2);
	return dp[idx]=min(x,y);
}
 signed main()
 {
     Anurag_Gupta
     IIIT_ALLD
     
    /* #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
     #endif*/

         cin>>n;
         for(int i=0;i<n;i++)
         	cin>>h[i];
         memset(dp,-1,sizeof dp);
         cout<<solve(0);

 }


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

int main(void){
    int n, a, b, sum = 0, f[110], ans=0;
    string sa, sb, sc;
    cin >> n;
    for(int i=0;i<n;++i){
        cin >> f[i];
        sum += f[i];
    }
    double ave = (double)sum/n;
    double min = 1000000;
    for(int i=0;i<n;++i){
        if(min > abs(ave-f[i])){
            min = abs(ave-f[i]);
            ans = i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())

min = float("inf")
for A in range(1,int((N**0.5))+1,1):
    if N%A!=0:
        continue
    B = N//A
    keta_A = len(str(A))
    keta_B = len(str(B))
    if keta_A >= keta_B:
        if keta_A<min:
            min = keta_A
        continue
    else:
        if keta_B<min:
            min = keta_B
print(min)


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

const int N = (1e5) + 5;
map<string, ll> m;
map<string, ll> :: iterator it;
int n;
char s[N][10];

// claudio van
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", s[i]);
    sort(s[i], s[i] + 10);
    m[s[i]]++;
  }
  ll ans = 0;
  for (it = m.begin(); it != m.end(); ++it) {
    ans += (it->second) * (it->second - 1) / 2;
  }
  printf("%lld\n", ans);
  return 0;
}

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

int main(){
	int n;
	cin >> n;
	char c;
	bool yellow = false;
	for (int i = 0; i < n; i++){
		cin >> c;
		if (c == 'Y')
			yellow = true;
	}
	cout << ((yellow) ? "Four" : "Three") << endl;
}

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

int main (void)
{
	int input1;
	int input[100];
	int i;
	
	scanf("%d",&input1);
	for(i = 0 ; i < input1 ; i++)
	{
		scanf("%d",&input[i]);
	}
	for(i = input1 - 1 ; i >= 0 ; i--)
	{
		printf("%d",input[i]);
		if(i != 0)
		{
			printf(" ");
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2024
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())

    x = int(N / 1.08)
    if int(x * 1.08) == N:
        print(x)
    elif int((x + 1) * 1.08) == N:
        print(x + 1)
    else:
        print(':(')


main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)  //0index
#define rep1(i,n) for (int i = 1; i < (n); ++i)  //1index
#define REP(i,a,b) for (int i = a; i < (b); ++i)  //aからb - 1まで
#define mREP(i,a,b) for (int i = a; i > (b); --i)  //逆
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;  //最大値兼MOD
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }  //GCD
int dp[100010][3];
int a[100010][3];
int main(){
    vector<int>a(4);
    vector<int>b(4);
    a = {1,4,7,9};
    rep0(i,4)cin >> b[i];
    sort(all(b));
    if(a == b){
        cout <<"YES"<< endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep2(i,x,y) for (int i = x; i < (y); ++i)
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
int INF = 100100101;
int main()
{
  ios::sync_with_stdio(false);  cin.tie(0); cout.tie(0);
  int n,x,t;
  cin>>n>>x>>t;
  int ans = n / x;
  if(n % x != 0) ans += 1;
  cout << ans * t << endl;
  return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include<numeric>
using namespace std;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;


int main(){
    string s; cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
	return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    ll A[4];
    rep(i,2){
        cin >> A[i];
    }
    // sort(A,A+3);
    cout << max(A[0]+A[1],max(A[0]-A[1],A[0]*A[1])) << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main() {
	string S;
	cin>>S;
	int x,y;
	cin>>x>>y;
	int nx=0,ny=0,a=0;
	int i=0;
	for(i=0;i<S.length();i++){
		if(S[i]=='T'){
			i++;
			a++;
			x-=i-1;
			goto next;
		}
	}
	x-=i;
	if(x==0 && y==0)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
	next:
	int cou=0;
	vint C[2];
	for(i;i<S.length();i++){
		if(S[i]=='T'){
			C[a].pb(cou);
			a=(a+1)%2;
			cou=0;
		}
		else
			cou++;
	}
	C[a].pb(cou);
	
	bool DPX[4001][16001]={},DPY[4001][16001]={};
	DPX[0][8000]=1,DPY[0][8000]=1;
	for(int i=0;i<C[0].size();i++){
		for(int j=0;j<=16000;j++){
			if(DPX[i][j]){
				DPX[i+1][j+C[0][i]]=1;
				DPX[i+1][j-C[0][i]]=1;
			}
		}
	}
	for(int i=0;i<C[1].size();i++){
		for(int j=0;j<=16000;j++){
			if(DPY[i][j]){
				DPY[i+1][j+C[1][i]]=1;
				DPY[i+1][j-C[1][i]]=1;
			}
		}
	}
	//cout<<x<<" "<<y<<endl;
	if(DPX[C[0].size()][x+8000] && DPY[C[1].size()][y+8000])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	/*
	for(int i=-5;i<5;i++){
		cout<<i<<" "<<DPY[1][i+8000]<<endl;
	}
	*/
	/*
	for(int i=0;i<2;i++){
		for(int j=0;j<C[i].size();j++)
			cout<<C[i][j]<<" ";
		cout<<endl;
	}
	*/
    return 0;
}

Measured memory_bytes: 125440
def main():
  n = int(input())
  ans = {}
  for i in range(n):
    num = int(input())
    if num in ans:
      del ans[num]
    else:
      ans[num] = True
  count = len(ans)
  print(count)
  
def input_list():
  return map(int, input().split())

def input_list_str():
  return map(str, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c 

import math
import fractions
from functools import reduce
main()

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

using namespace std;
using ll  = long long;
using ii  = pair < int , int >;
using pll = pair < ll , ll >;
using i3  = pair < int , ii >;
using vi  = vector < int >;
using vl  = vector < ll >;
using vii = vector < ii >;
using vi3 = vector < i3 >;

const int N = 2e5 + 5;
const ll INF = 1e12;
const double eps = 1e-9 , PI = acos(-1);

int n , m;

map < string , ll > mp;

void solve(){
    scanf("%d" , &n);

    while( n -- ){
        string s;
        cin >> s;
        sort(s.begin() , s.end());

        mp[s] += 1ll;
    }



    ll ans = 0ll;
    for(auto M : mp){
        ll tmp = M.second;

        ans += tmp * (tmp - 1ll) / 2ll;
    }

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

main(){
    int t = 1;
    //scanf("%d" , &t);

    while( t -- ){
            solve();
    }

    return 0;
}




Measured memory_bytes: 11136
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

struct edge{int to;int cap;int rev;};
struct Dinic{
private:
    int n;
    vector<vector<edge>> v;
    vector<int> dist,iter;
public:
    Dinic(int sz):n(sz),v(sz),dist(sz),iter(sz){}
    
    void addedge(int from,int to,int cap){
        int x=v[to].size(),y=v[from].size();
        v[from].push_back({to,cap,x});
        v[to].push_back({from,0,y});
    }
    
    void bfs(int s){
        fill(dist.begin(),dist.end(),-1);
        queue<int> q;
        dist[s]=0;
        q.push(s);
        while(q.size()){
            int x=q.front();q.pop();
            rep(i,v[x].size()){
                edge &e=v[x][i];
                if(e.cap>0&&dist[e.to]<0){
                    dist[e.to]=dist[x]+1;
                    q.push(e.to);
                }
            }
        }
    }
    
    int dfs(int x,int t,int f){
        if(x==t)return f;
        for(int& i=iter[x];i<(int)v[x].size();++i){
            edge& e=v[x][i];
            if(e.cap>0&&dist[x]<dist[e.to]){
                int d=dfs(e.to,t,min(f,e.cap));
                if(d>0){
                    e.cap-=d;
                    v[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    int max_flow(int s,int t){
        int flow=0;
        while(1){
            bfs(s);
            if(dist[t]<0)return flow;
            fill(iter.begin(),iter.end(),0);
            int f;
            while((f=dfs(s,t,inf))>0)flow+=f;
        }
    }
};

int main(){
    int h,w;
    cin>>h>>w;
    Dinic dn(h+w+2);
    string s[h];
    rep(i,h){
        cin>>s[i];
        rep(j,w){
            if(s[i][j]=='S'){
                dn.addedge(h+w, i, inf);
                dn.addedge(h+w, h+j, inf);
            }
            if(s[i][j]=='T'){
                dn.addedge(i,h+w+1, inf);
                dn.addedge(h+j,h+w+1, inf);
            }
            if(s[i][j]=='o'){
                dn.addedge(i, h+j, 1);
                dn.addedge(h+j, i, 1);
            }
        }
    }
    int ans=dn.max_flow(h+w, h+w+1);
    cout<<(ans>=inf?-1:ans)<<endl;
   return 0;
}


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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int, int> pii;

template <typename A, typename B>
string to_string(pair<A, B> p){
    return "(" + to_string(p.fi) + ", " + to_string(p.se) + ")";
}

template <typename T>
string to_string(T v){
    string s = "{";
    bool first = true;
    for(const auto & x : v){
        if(!first) s += ", ";
        first = false;
        s += to_string(x);
    }
    return s + "}";
}

void debug_out(){ cerr << endl;}
template <typename First, typename... Next>
void debug_out(First F, Next... N){
    cerr << " " << to_string(F);
    debug_out(N...);
}

#ifdef LOCAL
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 1
#endif

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

    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    int l = 0, r = 0;

    int now = 0;
    ll ans = 0;
    while(l < n){
        while(r < n and (now ^ a[r]) == now + a[r]){
            now ^= a[r++];
            ans++;
        }
        now ^= a[l++];
        ans += r - l;
    }
    cout << ans << endl;
    return 0;
}



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

int main() {
  int i, a, b, c, d;
  cin >> i;
  
  a = i / 1000;
  b = i % 1000 / 100;
  c = i % 1000 % 100 / 10;
  d = i % 1000 % 100 % 10;
    
  if ( b == c && (a == b || c == d)) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main()
{		
	int n, m = 0;
	char a[100], b[100], c[100];

	cin >> n >> a >> b >> c;

	for (int i = 0; i < n; i++) {
		if (a[i] == b[i])
			if (a[i] == c[i])
				continue;
			else
				m++;
		else if (a[i] == c[i])
			m++;
		else if (b[i] == c[i])
			m++;
		else
			m += 2;
	}

	cout << m << endl;

	return 0;
}


Measured memory_bytes: 256
mod=10**9+7
n,k=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True,key=lambda x:abs(x))
if k==n:
  ans=1
  for i in range(n):
    ans*=arr[i]
    ans%=mod
  print(ans)
else:
  if k%2==1 and max(arr)<0:
    ans=1
    for i in range(k):
      ans*=arr[n-1-i]
      ans%=mod
    print(ans)
  else:
    ans=1
    cnt=0
    for i in range(k):
      if arr[i]<0:
        cnt+=1
      ans*=arr[i]
      ans%=mod
    if cnt%2==0:
      print(ans)
    else:
      min_plus=-1
      min_minus=1
      for i in range(k):
        if arr[i]>=0:
          min_plus=arr[i]
        else:
          min_minus=arr[i]
      max_plus=-1
      max_minus=1
      for i in range(k,n):
        if arr[i]>=0 and max_plus==-1:
          max_plus=arr[i]
        if arr[i]<0 and max_minus==1:
          max_minus=arr[i]
      if min_plus==-1:        
        arr.remove(min_minus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%=mod
        ans*=max_plus
        ans%=mod
      elif min_minus==1:        
        arr.remove(min_plus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%=mod
        ans*=max_minus
        ans%=mod
      elif min_plus*max_plus>=min_minus*max_minus:
        arr.remove(min_minus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%=mod
        ans*=max_plus
        ans%=mod
      else:
        arr.remove(min_plus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%=mod
        ans*=max_minus
        ans%=mod
      print(ans)

Measured memory_bytes: 31636
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define int ll
#define pb push_back
#define sz(i) (int)(i.size())
#define fi first
#define se second
#define ld long double
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = 1e9 + 7;
using namespace std;
#ifndef ONLINE_JUDGE
#define tr(...) {__l(__LINE__);__f(#__VA_ARGS__, __VA_ARGS__);}
inline void __l(int line) { cerr << "#" << line << ": "; }template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << std::endl;}template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define tr(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
const int N = 3000 + 10;
// make sure N size is correctttt!!!!!!!!!

ld p[N];
ld dp[N][N];

int n;

#define eps 1e-6
bool match(int curr_val, int given){
   return abs(curr_val - given) <= eps;
}

ld solve(int idx1, int heads){
   if(idx1 >= n){
      return (heads > (n-heads));
   }
   ld &ans = dp[idx1][heads];
   if(!match(ans, -1)){
      return ans;
   }
   ld tt1 = solve(idx1+1, heads+1);
   ld tt2 = solve(idx1+1, heads);
   ans = (ld)p[idx1]*1.00000*(solve(idx1+1, heads+1)) + (ld)(1.00000-p[idx1])*solve(idx1+1, heads);
   return ans;
}

int32_t main(){_

   cin>>n;
   for (int i = 0; i < n; ++i)
   {
      cin>>p[i];
   }

   for (int i = 0; i < N; ++i)
   {
      for (int j = 0; j < N; ++j)
      {
         dp[i][j] = -1;
      }
   }

   cout << fixed << setprecision(15);
   cout<<solve(0,0);

   //make sure N size is correct!!!!!!!!!
   return 0;
}

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


int pop();
void push(int x);


int top,stack[1000]; //gaibu hennsuu

int main(){
  int x;
  char s[100];
  int a,b;

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' )
      {
      a=pop();
      b=pop();
      push(a+b);
      }
    else if ( s[0] == '-' )
      {
	b=pop();
	a=pop();
	push(a-b);
      }
    else if ( s[0] == '*' ){
      a=pop();
      b=pop();
      push(a*b);
    }
    else {
      push(atoi(s));

    }
  }
  printf("%d\n",pop());
  return 0;
}


int pop()
{

  top--;
  return stack[top+1];
}

void push(int x)
{

  stack[++top]=x;
 
}
  



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

using namespace std;

int main() {
  int n;cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  sort(a.begin(),a.end());
  cout<<a[n-1]-a[0]<<endl;
}

Measured memory_bytes: 3624
n=int(input())
def f(a,b):
    a=str(a)
    b=str(b)
    return(max(len(a),len(b)))

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

l=make_divisors(n)
ans=10**9+7
for i in l:
    ans=min(ans,f(i,n//i))

print(ans)



Measured memory_bytes: 39792
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, m;
    cin >> n >> m;    
    
    vector<vector<P>> G(n);  // 辺の重みがすべて0以上のグラフ
    rep(i, m) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(make_pair(b, 1));
    }

    ll sv, gv;
    cin >> sv >> gv;
    sv--;  gv--;
    
    // 拡張ダイクストラ法。計算量はO((V+E)*log(V))
    vvl dp(n, vl(3, INF));  // dp[v][i] : 頂点vまでの3で割った余りがiとなる時間の最小値
    dp[sv][0] = 0;
    priority_queue<pair<ll, P>, vector<pair<ll, P>>, greater<pair<ll, P>>> prQ;
    prQ.push(make_pair(dp[sv][0], make_pair(sv, 0)));  // (頂点vまでの余りがiのときの時間t, (いまいる頂点v, 余りi))
    while(!prQ.empty()) {
        auto p1 = prQ.top();
        prQ.pop();
        ll t = p1.first;  //頂点vまでの余りがiのときの時間t
        ll v = p1.second.first;  // いまいる頂点v
        ll i = p1.second.second;  // 所持金i
        if(dp[v][i] < t) {
            continue;
        }
        for(auto p2 : G[v]) {
            ll u = p2.first;
            ll cost = p2.second;
            ll ni = (i + cost)%3;
            if(dp[u][ni] > dp[v][i] + cost) {
                dp[u][ni] = dp[v][i] + cost;
                prQ.push(make_pair(dp[u][ni], make_pair(u, ni)));
            }
        }
    }
    
    if(dp[gv][0] == INF) {
        out(-1);
    }
    else {
        out(dp[gv][0]/3);
    }
    
    re0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N, K; cin >> N >> K;
    string S; cin >> S;

    int happy = 0;
    FOR(i,0,N-1){
        if (S[i] == 'L') happy += (i>0 and S[i-1] == 'L');
        else happy += (i<N-1 and S[i+1] == 'R');
    }

    cout << min(happy + 2*K, N-1) << '\n';
}



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


int main() {
    vector<vector<int>> a(3, vector<int>(3));
    rep(i,3)rep(j,3) cin >> a.at(i).at(j);

    int n;
    cin>>n;

    vector<int> b(n);
    rep(i,n) cin >> b.at(i);

    rep(k,n){
        rep(i,3)rep(j,3){
            if(a.at(i).at(j) == b.at(k)) a.at(i).at(j) = -1;
        }
    } 

    int flag = 0;
    rep(i,3){
        if(a.at(i).at(0)==-1 && a.at(i).at(1)==-1 && a.at(i).at(2)==-1) flag += 1;
    }
    rep(i,3){
        if(a.at(0).at(i)==-1 && a.at(1).at(i)==-1 && a.at(2).at(i)==-1) flag += 1;
    }
    if(a.at(0).at(0)==-1 && a.at(1).at(1)==-1 && a.at(2).at(2)==-1) flag += 1;
    if(a.at(0).at(2)==-1 && a.at(1).at(1)==-1 && a.at(2).at(0)==-1) flag += 1;
    
    
    if (flag == 0) cout << "No" << endl;
    else cout << "Yes" <<endl;
    return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int f(int a){
	string s=to_string(a);
	string t=s;
	reverse(all(s));
	return s==t;
}
int main(){
	int out=0,a,b;
	cin>>a>>b;
	loop(i,a,b+1)out+=f(i);
	cout<<out<<endl;
}






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

int main() {
  int a;
  cin>>a;
  if(a<10){
    cout<<a<<endl;
  }
  else if(a<100){
    cout<<9<<endl;
  }
  else if(a<1000){
    cout<<a-90<<endl;
  }
  else if(a<10000){
    cout<<909<<endl;
  }
  else if(a<100000){
    cout<<909+a-9999<<endl;
  }
  else{
    cout<<90909<<endl;
  }
}

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int N;
V col;

int main() {
    cin >> N;
    col.resize(N);
    VECCIN(col);
    int cnt = 0, con = 1;
    REP(i, N) {
        if(col[i] == col[i + 1]) {
            con++;
        } else {
            cnt += con / 2;
            con = 1;
        }
    }
    cout << cnt << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    int n;
    while(1){
        cin >> n;
        if(n==0) break;
        vector<int> V(10,0);
        rep(i,n){
            int tmp;
            cin >> tmp;
            V[tmp]+=1;
        }
        rep(i,10){
            if(V[i]==0) cout << '-' << endl;
            else{
                rep(j,V[i]) cout << '*';
                cout << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3020
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	return (a %= p) >= 0 ? a : a + p;
}

int power(int a, int N){
	if(N == 0) return 1;
	else if(N % 2 == 0) return power(MOD(a * a), N / 2);
	else return MOD(a * power(a, N - 1));
}

int inverse(int a){
	return power(a, p - 2);
}

int dfs(vector<vector<int>> &t, vector<int> &s, int v, int parent){
	s[v] = 1;
	for(int i = 0; i < t[v].size(); i++){
		if(t[v][i] != parent){
			s[v] += dfs(t, s, t[v][i], v);
		}
	}
	return s[v];
}

signed main(){
	int N, i, j;
	scanf("%lld", &N);
	vector<vector<int>> t(N, vector<int>(0));
	for(i = 1; i < N; i++){
		int A, B;
		scanf("%lld%lld", &A, &B);
		A--;
		B--;
		t[A].push_back(B);
		t[B].push_back(A);
	}
	vector<int> powinv2(N + 1, 1);
	for(i = 1; i <= N; i++){
		powinv2[i] = MOD(powinv2[i - 1] * ((p + 1) / 2));
	}
	vector<int> s(N, 0);
	int res = dfs(t, s, 0, -1);
	int ans = 0;
	for(i = 0; i < N; i++){
		int now = 0;
		for(j = 0; j < t[i].size(); j++){
			int sub;
			if(s[i] > s[t[i][j]]){
				sub = s[t[i][j]];
			}
			else{
				sub = N - s[i];
			}
			now = MOD(now + powinv2[N - 1 - sub] * (1 - powinv2[sub]));
		}
		now = MOD(now + powinv2[N - 1]);
		now = MOD(1 - now);
		now = MOD(now * powinv2[1]);
		ans = MOD(ans + now);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 25728
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
int A, T, G, C, N;
map<string, vector<string> > M;
map<string, vector<string> > mem;

const lli mod = 1000000007LL;
lli dp[2][51][51][51];

vector<string> rec(const string &s) {
  if(mem.count(s)) return mem[s];
  for(int i = 0; i < M[s].size(); ++i) {
    if(M[s][i][0] == '[') {
      mem[s].push_back(M[s][i]);
    } else {
      vector<string> v = rec(M[s][i]);
      for(int j = 0; j < v.size(); ++j) {
        mem[s].push_back(v[j]);
      }
    }
  }
  if(mem[s].size() > 200) throw 0;
  return mem[s];
}

int main() {
  cin >> A >> T >> G >> C;
  cin >> N;
  string src;
  for(int i = 0; i < N; ++i) {
    string id;
    cin >> id;
    id = id.substr(0, (int)id.size()-1);
    if(src.empty()) src = id;
    string line;
    getline(cin, line);
    stringstream ss(line);
    for(string s; ss >> s; ) {
      M[id].push_back(s);
    }
  }
  try {
    vector<string> v = rec(src);
    int n = v.size();
    if(n != A+T+G+C) {
      throw 0;
    }
    memset(dp, 0, sizeof(dp));
    dp[0][0][0][0] = 1;
    for(int i = 0; i < n; ++i) {
      int now = (i & 1);
      int next = 1 - now;
      for(int a = 0; a <= A; ++a) {
        for(int t = 0; t <= T; ++t) {
          for(int g = 0; g <= G; ++g) {
            dp[next][a][t][g] = 0;
          }
        }
      }

      for(int a = 0; a <= A; ++a) {
        for(int t = 0; t <= T; ++t) {
          for(int g = 0; g <= G; ++g) {
            int c = i - (a+t+g);
            for(int k = 1; k+1 < v[i].size(); ++k) {
              if(v[i][k] == 'A' && a+1 <= A) {
                ( dp[next][a+1][t][g] += dp[now][a][t][g] ) %= mod;
              }
              if(v[i][k] == 'T' && t+1 <= T) {
                ( dp[next][a][t+1][g] += dp[now][a][t][g] ) %= mod;
              }
              if(v[i][k] == 'G' && g+1 <= G) {
                ( dp[next][a][t][g+1] += dp[now][a][t][g] ) %= mod;
              }
              if(v[i][k] == 'C' && c+1 <= C) {
                ( dp[next][a][t][g] += dp[now][a][t][g] ) %= mod;
              }
            }
          }
        }
      }
    }
    cout << dp[n&1][A][T][G] << endl;
  } catch(...) {
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 3380
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimze("02")
using namespace std;
using ll =long long;
const ll  maxn=4e5+5,inf=1e9+5;
ll  a,b,n,x;
int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>a>>b>>n;
	x=b-1;
	x=min(x,n);
	cout<<((x*a)/b)-a*(x/b);
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#define strmax 100000
using namespace std;
std::string s, t;
int pss[strmax+1], pst[strmax+1];
int q;
int m3(int x)
{
    return (x < 0) ? x + 3 : ((x < 3) ? x : x - 3);
}
int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> s >> t >> q;
    for(int i = 1; i <= s.size(); ++i)
      pss[i] = m3(pss[i - 1] + ((s[i - 1] == 'A') ? 1 : 2));
    for(int i = 1; i <= t.size(); ++i)
      pst[i] = m3(pst[i - 1] + ((t[i - 1] == 'A') ? 1 : 2));
    for(int z = 0; z < q; ++z){
      int a, b, c, d;
      cin >> a >> b >> c >> d;
      if(m3(pss[b] - pss[a - 1]) == m3(pst[d] - pst[c - 1]))
        cout << "YES\n";
      else cout << "NO\n";
    }
    return 0;
}


Measured memory_bytes: 1744
#include<iostream>
using namespace std;
int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    
    if(((x + r)<= W) && ((x - r)>=0) && ((y + r) <= H) && ((y - r) >= 0)){
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3116
#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(){
    ll N;
    cin >> N;
    if (N % 2 == 1) cout << 0 << endl;
    else {
        ll ans = 0;
        ll fact = 10;
        rep(i, 40) {
            ans += N / fact;
            fact *= 5;
        }
        cout << ans << endl;
    }



	return 0;
}



Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if(i*500+j*100+k*50 == x):
                count = count+1
print(count)

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



int main(void){
	int n;
	int *s;
	double m,s2;


	while(1){
		scanf("%d",&n);

		if(n==0){
			break;
		}

		s=(int*)malloc(n*sizeof(int));
		m=0;
		s2=0;
		for(int i=0;i<n;i++){
			scanf("%d",&s[i]);
			m+=s[i];
		}
		m/=n;
		for(int i=0;i<n;i++){
			s2+=((s[i]-m)*(s[i]-m));
		}
		s2/=n;
		printf("%f\n",sqrt(s2));
	}

}


Measured memory_bytes: 2096
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fo(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define umap unordered_map
#define minHeap(t) priority_queue<t, vector<t>, greater<t>>
#define maxHeap(t) priority_queue<t>

int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    //cin>>t;
    while(t--){
        int x,y;
        cin>>x>>y;
        if((y&1)==1){
            cout<<"No"<<endl;
        }
        else{
            if(y>(4*x) || y<(2*x)){
                cout << "No" << endl;
            }
            else if((y-(2*x))%2!=0){
                cout<<"No"<<endl;
            }
            else{
                cout<<"Yes"<<endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define MAX 128
#define fst first
#define sec second
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define bit(n) (1LL << (n))
#define int long long
const double PI = 3.141593;
const ll MOD = 1e9 + 7;
const int INF = 100100100;
const double EPS = 1e-9;
template <class T>
bool chmax(T &a, const T &b){if (a < b){a = b;return 1;}return 0;}
template <class T>bool chmin(T &a, const T &b){if (b < a){a = b;return 1;}return 0;}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }     //最小公倍数
ll combination(ll n, ll r){if (r * 2 > n)r = n - r;ll dividend = 1;ll divisor = 1;for (ll i = 1; i <= r; ++i){dividend *= (n - i + 1);divisor *= i;}return dividend / divisor;}


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    map<ll, int> m;
    rep(i, n)
    {
        ll tmp;
        cin >> tmp;
        if (m.count(tmp))
        {
            cout << "NO" << endl;
            return 0;
        }
        m.insert(make_pair(tmp, 1));
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 1000000007
#define N 10005
bool Check(int n,int pos){
    return (bool)(n & (1<<pos));
}
int main()
{
    int h,w,k;
    cin>>h>>w>>k;
    string s[h+5];
    for(int i=0;i<h;i++) cin>>s[i];
    int ans=0;
    for(int i=0;i<(1<<h);i++)
    {
        for(int j=0;j<(1<<w);j++)
        {
            int cnt=0;
            for(int p=0;p<h;p++)
            {
                for(int q=0;q<w;q++)
                {
                    if(s[p][q]=='#' && !Check(i,p) && !Check(j,q)) cnt++;
                }
            }
            if(cnt==k) ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <stdlib.h>
int main(){
	int n;
	scanf("%d",&n);
	if(n!=1){
		int m_num=0;
		int m_time=0;
		for(int i=n;i>0;i--){
			if(i%2==0){
				int cnt=0;
				int mem=i;
				int flag=-1;
				while(mem%2==0){
					mem/=2;
					cnt++;
				}
				if(cnt>m_time){
					m_time=cnt;
					m_num=i;
				}

			}
		}
		printf("%d\n",m_num);

	}
	else{
		printf("1\n");
	}
	return 0;

}

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

#define ll long long
#define ull unsigned long long
#define mii make_pair<int, int>
#define mll make_pair<ll, ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define all(v) (v).begin(), (v).end()

ofstream out("debug.txt");

const int MxN = 1e5, md = 1e9 + 7;

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

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

    vb p(1e6 + 1, 1);
    for (ll i = 2; i * i <= 1e6; ++i)
        if (p[i])
            for (ll j = i * i; j <= 1e6; j += i)
                p[j] = 0;
    vl prime;
    for (ll i = 2; i <= 1e6; ++i)
        if (p[i])
            prime.push_back(i);

    int n;
    cin >> n;
    vl v(n), tb(1e6 + 1, 0);
    ll g;
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
        tb[v[i]]++;
        if (i)
            g = gcd(g, v[i]);
        else
            g = v[i];
    }
    int mul;
    bool pw = 1;
    for (auto a : prime)
    {
        mul = 0;
        for (int i = a; i <= 1e6; i += a)
            mul += tb[i];
        if (mul >= 2)
        {
            pw = 0;
            break;
        }
    }
    if (g > 1)
        cout << "not coprime";
    else if (pw)
        cout << "pairwise coprime";
    else
        cout << "setwise coprime";
}

Measured memory_bytes: 19656
s=input()
t=input()
ls=len(s)
lt=len(t)
ans=lt

for i in range(0,ls-lt+1):
	count = 0
	for j in range(lt):
		if s[i+j]!=t[j]:
			count+=1
	if count<ans:
		ans=count
print(ans)

Measured memory_bytes: 8812