akhauriyash/Code-Regression huggingface dataset:
s=input()
t=input()
#print(s,t)

listA=[s.count(chr(i)) for i in range(97,122+1)]
listB=[t.count(chr(i)) for i in range(97,122+1)]
#print(listA)
#print(listB)

listA.sort()
listB.sort()
#print(listA)
#print(listB)

print('Yes' if listA==listB else 'No')

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


using namespace std;


int a[100005], p[100005],n, i;
int respuesta(int x)
{
    if(x==n) return 0;
    if(x>n) return 1e9;
    if(p[x]!=-1)return p[x];
    return p[x]=min(abs(a[x+1]-a[x])+respuesta(x+1), abs(a[x+2]-a[x])+respuesta(x+2));
}


int main()
{
    memset(p,-1,sizeof p);
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    cout<<respuesta(1)<<endl;
    return 0;
}


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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	char x, y;
	cin >> x >> y;
	if (x < y) {
		cout << '<' << endl;
	} else if (x > y) {
		cout << '>' << endl;
	} else {
		cout << '=' << endl;
	}
}

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

int main(void){
  int A,N;
  
  if(scanf("%d", &N)==-1){exit(1);}else{;
    if(scanf("%d", &A)==-1){exit(1);}
  }
  if( N % 500 - A > 0){
    printf("No ");
  } else {
    printf("Yes ");
  }
  
  return 0;
}
    

Measured memory_bytes: 128
<?php
fscanf(STDIN, '%s', $str);

function checkFormat($str) {
    $top = intval($str[0].$str[1]);
    $bottom = intval($str[2].$str[3]);
    if ($top <= 0 && $bottom <= 0) {
        return 'NA';
    } 
    elseif ($top <= 0) {
        if ($bottom > 0 && $bottom <= 12) {
            return 'YYMM';
        }
        return 'NA';
    } elseif ($bottom <= 0) {
        if ($top > 0 && $top <= 12) {
            return 'MMYY';
        }
        return 'NA';
    } elseif (($top > 0 && $top <= 12) || ($bottom > 0 && $bottom <= 12)) {
        if ($top > 0 && $top <= 12 && $bottom > 12) {
            return 'MMYY';
        } elseif ($bottom > 0 && $bottom <= 12 && $top > 12) {
            return 'YYMM';
        } else {
            return 'AMBIGUOUS';
        }
    } else {
        return 'NA';
    }
}

echo checkFormat($str)."\n";

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";

int main(){
  string s; cin >> s;
  cout << ((s[0]==s[1]||s[1]==s[2]||s[2]==s[3]) ? "Bad" : "Good") << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second

typedef long long ll;

using namespace std;

int main()

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

    string s;

    cin >> s;

    if (s[5] == '0' && s[6] <= '4' && (s[8] < '3' || (s[8] == '3' && s[9] == '0'))) cout << "Heisei";
    else cout << "TBD";

    return 0;
}


Measured memory_bytes: 256
use proconio::{input, fastout};
use std::collections::HashMap;
use std::cmp::Reverse;

#[fastout]
fn main() {
    input! {
        _h: usize,
        _w: usize,
        m: usize,
        hw: [(usize, usize); m],
    }

    let mut map_h = HashMap::new();
    let mut map_w = HashMap::new();
    let mut map_hw = HashMap::new();

    for &(h, w) in hw.iter() {
        *map_h.entry(h).or_insert(0) += 1;
        *map_w.entry(w).or_insert(0) += 1;
        *map_hw.entry((h, w)).or_insert(0) += 1;
    }

    let mut map_h = map_h.iter().map(|(&k, &v)| (k, v)).collect::<Vec<_>>();
    map_h.sort_by_key(|&(_, v)| Reverse(v));
    let mut map_w = map_w.iter().map(|(&k, &v)| (k, v)).collect::<Vec<_>>();
    map_w.sort_by_key(|&(_, v)| Reverse(v));


    let mut ans = 0;

    for &(h, n_h) in map_h.iter() {
        for &(w, n_w) in map_w.iter() {
            if let Some(&n_hw) = map_hw.get(&(h, w)) {
                ans = std::cmp::max(ans, n_h + n_w - n_hw);
            } else {
                ans = std::cmp::max(ans, n_h + n_w);
                break;
            }
        }
    }

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


Measured memory_bytes: 53708
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

static const int mod = 1e9 + 7;

ll powmod(ll a, ll b, ll m) {
    if (b == 0) return 1;
    if (b % 2 == 0) {
        ll t = powmod(a, b / 2, m);
        return t * t % mod;
    }
    else {
        return a * powmod(a, b - 1, m);
    }
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll n;
    cin >> n;
    vector<int> a(n, 0);
    rep(i, n) {
        int b;
        cin >> b;
        a[b]++;
    }

    bool ok = true;
    if (n % 2 == 0) {
        rep(i, n) {
            if (i % 2 == 0 && a[i] > 0) ok = false;
            else if (i % 2 == 1 && a[i] != 2) ok = false;
        }
        if (ok) cout << powmod(2, n / 2, mod) << endl;
    }
    else {
        rep(i, n) {
            if (i == 0 && a[i] != 1) ok = false;
            else if (i % 2 == 1 && a[i] > 0) ok = false;
            else if (i % 2 == 0 && i != 0 && a[i] != 2) ok = false;
        }
        if (ok) cout << powmod(2, (n - 1) / 2, mod) << endl;
    }

    if (!ok) cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 640
import math
a,b,c,d = map(int,input().split())
e = c*d//math.gcd(c,d)
wa = 0
c_seki = b//c-(a-1)//c
d_seki = b//d-(a-1)//d
e_seki = b//e-(a-1)//e
wa = c_seki+d_seki-e_seki
print(b-a+1-wa)

Measured memory_bytes: 9168
#include  <stdio.h>

int main(void)
{		
  int n,i,j,temp1,x1[100],x2[100],x3[100],mini,count=0,temp3;
  char c1[100],c2[100],temp2;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c%d",&c1[i],&x1[i]);
  }
  for(i=0;i<n;i++){
    c2[i]=c1[i];
    x2[i]=x1[i];
    x3[i]=i;
  }
  
  
  for (i=0;i<n;i++){
    for (j=n-1;j>=i+1;j--){
      if (x1[j-1]>x1[j]){ 
	temp1=c1[j];      
	c1[j]=c1[j-1];
	c1[j-1]=temp1;
	temp1=x1[j];      
	x1[j]=x1[j-1];
	x1[j-1]=temp1;
      }
    }	
  }
  for(i=0;i<n;i++){
    if(i==n-1)
      printf("%c%d\n",c1[i],x1[i]);
    else
      printf("%c%d ",c1[i],x1[i]); 
  }
    printf("Stable\n");
  for (i=0;i<n;i++){
    mini=i;
    for (j=i;j<n;j++){
      if (x2[j]<x2[mini]){
	mini=j;
      }
    }
    temp2 = c2[i];        
    c2[i] = c2[mini];
    c2[mini]= temp2;
    temp1 = x2[i];        
    x2[i] = x2[mini];
    x2[mini]= temp1;
    temp3=x3[i];
    x3[i]=x3[mini];
    x3[mini]=temp3;
  }	
  for(i=0;i<n;i++){
    if(i>0 && x2[i-1]==x2[i] && x3[i-1]>x3[i])
      count++;
    if(i==n-1)
      printf("%c%d\n",c2[i],x2[i]);
    else
      printf("%c%d ",c2[i],x2[i]);
  }
  if(count>0)
    printf("Not stable\n"); 
  else
    printf("Stable\n");
  return 0;
}

Measured memory_bytes: 608
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, K; cin >> N >> K;
	int ans = 0;
	rep(i, 0, N) {
		int x; cin >> x;
		ans += min(x, K - x) * 2;
	}
	cout << ans << endl;
	return 0;
}

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

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
int g(int N) {
	if (N % 4 == 0) {
		return N;
	}
	if (N % 4 == 1) {
		return 1;
	}
	if (N % 4 == 2) {
		return N + 1;
	} else {
		return 0;
	}
}
signed main() {
	cin >> N >> M;
	cout << (g(N - 1) ^ g(M)) << endl;
	return 0;
}

Measured memory_bytes: 384
import java.util.*;
 
public 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();
      }
    }
    int n=sc.nextInt();
    int[] g=new int[n];
    for(int i=0;i<n;i++){
      g[i]=sc.nextInt();
      for(int x=0;x<3;x++){
        for(int y=0;y<3;y++){
          if(g[i]==a[x][y]){
            a[x][y]=0;
          }
        }
      }
    }
    
    if((a[0][0]==a[0][1]&&a[0][1]==a[0][2])||(a[1][0]==a[1][1]&&a[1][1]==a[1][2])||(a[2][0]==a[2][1]&&a[2][1]==a[2][2])||(a[0][0]==a[1][0]&&a[1][0]==a[2][0])||(a[0][1]==a[1][1]&&a[2][1]==a[1][1])||(a[0][2]==a[1][2]&&a[1][2]==a[2][2])||(a[0][0]==a[1][1]&&a[1][1]==a[2][2])||(a[0][2]==a[1][1]&&a[1][1]==a[2][0])){
      System.out.print("Yes");
    }else{
      System.out.print("No");
    }
  }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
#define fi cin
#define fo cout 
#define repi(i,a,n) for(i=a;i<n;i++)
#define repie(i,a,n) for(i=a;i<=n;i++)
#define repd(i,a,n) for(i=n;i>a;i--)
#define repde(i,a,n) for(i=n;i>=a;i--) 
#define pb(n) push_back(n)
#define ff first
#define ss second
#define dfo if(0) cout
#define mod 1000000007

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(0);
	fi.tie(0);
	fo.tie(0);

	ll i,j,k,p1,p2,i1,i2,n,m;

	fi>>n;
	ll x[n],y[n];

	repi(i,0,n)
	{
		fi>>x[i];
		y[i]=x[i];
	}

	sort(x,x+n);
	
	/*repi(i,0,n)
		fo<<x[i]<<" ";
	fo<<endl;	
	*/
	i1=n/2-1,i2=n/2;
	//fo<<"i1:"<<i1<<" i2:"<<i2<<endl;
	p1=x[i1],p2=x[i2];

	for(i=0;i<n;++i)
	{
		if(y[i] < p2)
			fo<<p2<<endl;
		else fo<<p1<<endl;		
	}	




}

Measured memory_bytes: 5376
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    string S;
    cin >> S;
    ll len = S.size();
    bool bo[len];
    REP(i, 0, len) {
        if (S[i] == '#') {
            bo[i] = true;
        } else {
            bo[i] = false;
        }
    }
    bool aok = true;
    bool mark = false;
    REP(i, A - 1, C) {
        if (bo[i]) {
            if (mark) {
                aok = false;
                break;
            } else {
                mark = true;
            }
        } else {
            mark = false;
        }
    }
    bool bok = true;
    mark = false;
    REP(i, B - 1, D) {
        if (bo[i]) {
            if (mark) {
                aok = false;
                break;
            } else {
                mark = true;
            }
        } else {
            mark = false;
        }
    }
    if (!aok || !bok) {
        cout << "No" << endl;
        return 0;
    }
    if (C < D) {
        cout << "Yes" << endl;
        return 0;
    }
    bool ok = false;
    REP(i, B - 1, D) {
        if (!bo[i - 1] && !bo[i] && !bo[i + 1]) {
            ok = true;
            break;
        }
    }
    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 720
#include <stdio.h>
int main(void)
{
	char x,y;
	int X,Y;
	int a=10,b=11,c=12,d=13,e=14,f=15;
	while(scanf("%c %c",&x,&y)!=EOF)
	{
		X=x;
		Y=y;
		if(X<Y)
			printf("<\n");
		if(X>Y)
			printf(">\n");
		if(X==Y)
			printf("=\n");
		getchar();	
	}
	return 0;
 } 

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

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n, D, A, cnt, ans, x[MAXN], H[MAXN];
set<pll> st;
pll p[MAXN];

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

    cin >> n >> D >> A;
    for (ll i = 0; i < n; i++) cin >> x[i] >> H[i], p[i] = {x[i], H[i]};
    sort(p, p + n);

    for (ll i = 0; i < n; i++) {
        while (SZ(st) != 0 && (*st.begin()).X + D + D < p[i].X) {
            cnt -= (*st.begin()).Y;
            st.erase(st.begin());
        }
        ll x = max(0LL, p[i].Y - cnt * A);
        ans += (x + A - 1) / A;
        cnt += (x + A - 1) / A;
        st.insert({p[i].X, (x + A - 1) / A});
    }
    cout << ans << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 25088
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    string s; cin >> s;
    int a = 0, b = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'A') {
            a = i; break;
        }
    }
    for (int i = s.length() - 1; i >= 0; i--) {
        if (s[i] == 'Z') {
            b = i; break;
        }
    }
    printf("%d\n", b - a + 1);
}


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<max(a+b,max(a-b,a*b))<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	string str;
	int ans[30];

	for (int i = 0; i < 30; ++i) {
		ans[i] = 0;
	}

	while( cin>>str ) {
		for (int i = 0; i < (int)str.size(); ++i) {
			str[i] = tolower(str[i]);
			ans[(int)str[i] - 97] += 1;
		}
	}

	for (int i = 0; i < 26; ++i) {
		cout << (char)(i + 97) << " : " << ans[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 3164
#include <stdio.h>
#define NIL -1
 
struct setu {
  int r;
  int l;
  int p;
};
struct setu T[100000];
int n,K[100000];
 
int depth(int,int);
void strk(int);
 
int main(){
 
  int i,j,id,k,c,l,r;
 
  scanf("%d",&n);
 
 
  for(i=0;i<n;i++){
    T[i].p = NIL;
    T[i].l = NIL;
    T[i].r = NIL;
  } 
  for(i=0;i<n;i++){
 
    scanf("%d %d",&id,&k);
 
    for(j=0;j<k;j++){
 
      scanf("%d",&c);
      if( j==0 ) T[id].l = c;
      else T[l].r = c;
      l = c;
      T[c].p = id;
 
    }
  }
 
  for(i=0;i<n;i++){
    if(T[i].p == NIL) r = i;
  }
  depth(r,0);
 
  for(i = 0;i<n ;i++) strk(i);
 
  return 0;
}
 
int depth(int u, int p){
  K[u] = p;
  if(T[u].r != NIL) depth(T[u].r,p);
  if(T[u].l != NIL) depth(T[u].l,p + 1);
}
 
void strk(int u){
 
  int i,c;
 
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].p);
  printf("depth = %d, ", K[u]);
 
  if(T[u].p == NIL ) printf("root, ");
 
  else if(T[u].l == NIL) printf("leaf, ");
 
  else printf("internal node, ");
 
  printf("[");
 
  for(i=0,c = T[u].l ; c !=NIL;i++,c = T[c].r){
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

Measured memory_bytes: 5300
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split()) 
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
for i in range(1,10):
  for j in range(1,10):
    if n==i*j:
      print('Yes')
      exit()
print('No')


Measured memory_bytes: 38384
N = int(input())
A = [0]
B = list(map(int, input().split()))
A += B
#print(A)

sig = [0] * N

for i in range(N-1):
  sig[A[i+1]-1] += 1
#print(sig)

#print(sig)
for i in sig:
  print(i)

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

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll N;

int main(){
	cin >> N;
	p((N+1)/2);
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
using System.Security.Principal;
using System.Text;
class Simple {
    private long N, A, B;
    void Solve() {
        //input
        N = io.Long;
        A = io.Long;
        B = io.Long;
        //cal
        var ans = 0L;
        if(N == 0 || A > B || (N == 1 && A != B)) { ans = 0; } else {
            //var Max = A + (N - 1) * B;
            //var Min = (N - 1) * A + B;
            var range = (B - A) * (N - 2);
            ans += range + 1;
        }
        //ret
        Console.WriteLine(ans);
    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Simple().Stream();
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] {' '};
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if(BufferCnt < nextBuffer.Length) return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while(st == "") st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


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

typedef long long ll;

ll N;

const int INF=1000000007;

int main(){

cin>>N;

int n=sqrt(N); 

int Min=INF;

for(int i=n+1; i>=1; i--){
	if(N%i==0){
		int M=N/i;
		stringstream a; a<<i;
		stringstream b; b<<M;
		string A=a.str(); int p=A.size();
		string B=b.str(); int q=B.size();
		int C=max(p,q); 
		if(C<Min) Min=C;
	}
}

cout<<Min<<endl;

return 0;
 
}

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

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

    int c = 0;
    if (s[0] == '1') c++;
    if (s[1] == '1') c++;
    if (s[2] == '1') c++;

    cout << c << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RF(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define deb(x )     cerr << #x << " here "<< x << endl;
#define endl    "\n"
#define printCase() "Case #" << caseNum << ": "
inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
/*----------------------------------------------------------------------*/

const int K=1e5+5;
int dp[K], a[105]; // 0 - losing pos, 1 - winning pos

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);

    int n,k;
    cin>>n>>k;

    memset(dp, 0, sizeof(dp));
    F(i, 0, n) {
    	cin>>a[i];
    }

    F(i, 1, k+1) {
    	bool found = false;
    	F(j, 0, n) {
    		if(i < a[j]) continue;
    		found |= (dp[i - a[j]] == 0);
    	}

    	if(found) dp[i]=1;
    	else dp[i]=0;
    }

    if(dp[k]) {
    	cout<<"First";
    } else {
    	cout<<"Second";
    }


    return 0;
}/*

*/


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

int main(){
//srandom((unsigned long)time(NULL));
long long n;
string s;
cin>>s;
n=s.size();
//00 11 はどうしようもない
//最終的に1111 or 00000
long long cnt0=0,cnt1=0;
for(long long i=0;i<n;i++){
    if(s[i]=='0') cnt0++;
    else cnt1++;
}
long long ins=cnt0;
if(cnt0>cnt1){
    cnt0=cnt1;
    cnt1=ins;
}
//cnt1>=cnt0になった

cout<<2*cnt0<<endl;

return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
    struct newdata
    {
        int label,cnt;
    };
    int n,m;
    int a[301][301];
    newdata rankm[301];
    bool used[301];
bool cmp(newdata i,newdata j)
{
    return (i.cnt>j.cnt);
}
int main()
{
    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
        {
            scanf("%d",&a[i][j]);
            if (j==1) rankm[a[i][j]].cnt++;
        }
    int now=0;
    for (int i=1;i<=m;i++)
        rankm[i].label=i;
    int ans=2147483647;
    while (now<m)
    {
        sort(rankm+1,rankm+m+1,cmp);
        ans=min(ans,rankm[1].cnt);
        used[rankm[1].label]=true;
        memset(rankm,0,sizeof(rankm));
        for (int i=1;i<=m;i++)
            rankm[i].label=i;
        for (int i=1;i<=n;i++)
            for (int j=1;j<=m;j++)
                if (!used[a[i][j]])
                {
                    rankm[a[i][j]].cnt++;
                    break;
                }
        now++;
    }
    printf("%d",ans);
}

Measured memory_bytes: 512
n, m = map(int, input().split())
a = [0] + [int(input()) for _ in range(m)]

ok = [True] * (n + 1)
for v in a:
    ok[v] = False

dp = [0] * (n + 1)
dp[0] = 1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1
MOD = 10 ** 9 + 7

for i in range(2, n + 1):
    if ok[i]:
        dp[i] = dp[i - 1] + dp[i - 2]
        dp[i] %= MOD

print(dp[-1])


Measured memory_bytes: 8472
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
typedef long long LL;

int kano()
{
	char ch=getchar();int w=0,u=1;
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')u=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())w=w*10+ch-'0';
	return w*u;
}
int n,v,o,u,mx;
int a[200005];
int p[21][200005],r[21][200005];
int f[2][262145];
bool bo[200005];
int main()
{
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	n=kano();v=kano();
	for(int i=1;i<=n;i++)a[i]=kano();
	for(o=v,u=0;o>0;o=o>>1,u++)
	{
		int la=1;p[u][1]=1;r[u][1]=1;
		for(int i=2;i<=n;i++)
		{
			if(a[i]-a[i-1]<=o)
			{
				p[u][la]=i;
				r[u][i]=la;
			}
			else 
			{
				la=i;
				p[u][la]=i;
				r[u][i]=la;
			}	
		}
	}
	for(int i=1;i<=n;i++)p[u][i]=r[u][i]=i;
	mx=1<<u;mx--; 
	for(int i=0;i<=mx;i++)
	{
		if(f[0][i]>n)f[0][i]=n;
		for(int j=1,l=1;j<=mx;j=j<<1,l++)
		{
			if(i&j)continue;
			if(f[0][i]!=n)f[0][i|j]=max(f[0][i|j],p[l][r[l][f[0][i]+1]]);
			else f[0][i|j]=n;
		}
	}
	for(o=v>>1,u=1;o>0;o=o>>1,u++)
	{
		int la=n;p[u][n]=n;r[u][n]=n;
		for(int i=n-1;i>=1;i--)
		{
			if(a[i+1]-a[i]<=o)
			{
				p[u][la]=i;
				r[u][i]=la;
			}
			else 
			{
				la=i;
				p[u][la]=i;
				r[u][i]=la;
			}
		}
	}
	for(int i=1;i<=n;i++)p[u][i]=r[u][i]=i;
	for(int i=0;i<=mx;i++)f[1][i]=n+1;
	for(int i=0;i<=mx;i++)
	{
		if(f[1][i]<1)f[1][i]=1;
		for(int j=1,l=1;j<=mx;j=j<<1,l++)
		{
			if(i&j)continue;
			if(f[1][i]!=1)f[1][i|j]=min(f[1][i|j],p[l][r[l][f[1][i]-1]]);
			else f[1][i|j]=1;
		}
	}
	r[0][0]=r[0][1];
	r[0][n+1]=r[0][n];
	for(int i=0;i<=mx;i++)
	{
		int j=~i&mx;
		if(r[0][f[0][i]+1]==r[0][f[1][j]-1])bo[r[0][f[0][i]+1]]=1;
		else if(r[0][f[0][i]+1]>r[0][f[1][j]-1])
		{
			bo[0]=1;
			break;
		} 
	}
	for(int i=1;i<=n;i++)
	{
		if(bo[0]||bo[r[0][i]])puts("Possible");
		else puts("Impossible");
	}
}










Measured memory_bytes: 37760
#include<bits/stdc++.h>
using namespace std;
double a[100],ans;
int n;
int main(){
	cin>>n;
	for (int i=0;i<n;i++) cin>>a[i];
	for (int i=0;i<n;i++){
		sort(a,a+n-i);reverse(a,a+n-i);
		if (i==0)
			ans=a[n-i-1];
		else
			ans=(ans+a[n-i-1])/2;
	}
	cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import math

def gcd(n1,n2,n3):
    return math.gcd(math.gcd(n1,n2), n3)
    
ans = 0
K = int(input())
r = range(1, K+1)

print(sum([gcd(x1,x2,x3) for x1 in r for x2 in r for x3 in r ]))

Measured memory_bytes: 71456
def main():
    t1, t2 = map(int, raw_input().split())
    a1, a2 = map(int, raw_input().split())
    b1, b2 = map(int, raw_input().split())
    ax1 = t1 * a1
    bx1 = t1 * b1
    ax2 = t2 * a2
    bx2 = t2 * b2
    if ax1 + ax2 == bx1 + bx2:
        print 'infinity'
        return
    if ax1 + ax2 < bx1 + bx2:
        ax1, bx1 = bx1, ax1
        ax2, bx2 = bx2, ax2
    init_d = bx1 - ax1
    if init_d < 0:
        print 0
        return
    total_delta = ax1 + ax2 - bx1 - bx2
    ans = 1 + (init_d / total_delta) * 2
    if init_d % total_delta == 0:
        ans -= 1
    print ans

main()


Measured memory_bytes: 28396
open System.Collections.Generic

type Scanner() = class
    let mutable hold = [||]
    let mutable index = 0
    member public this.Next() =
        if hold.Length > index
        then 
            index <- index + 1
            hold.[index - 1]
        else
            let mutable st = stdin.ReadLine()
            while st = "" do st <- stdin.ReadLine()
            hold <- st.Split(' ')
            if hold.Length = 0
            then
                this.Next()
            else
                index <- 1
                hold.[index - 1]
            
    member public this.NextI32() =
        this.Next() |> int

    member public this.ArrayI32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI32()|]

    member public this.NextI64() =
        this.Next() |> int64
    
    member public this.ArrayI64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI64()|]

    member public this.NextF32() =
        this.Next() |> float32
    
    member public this.ArrayF32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF32()|]

    member public this.NextF64() =
        this.Next() |> double
    
    member public this.ArrayF64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF64()|]

    member public __.Tuple2Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 2 |> fun x -> x.[0], x.[1]|]
    
    member public __.Tuple3Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 3 |> fun x -> x.[0], x.[1], x.[2]|]

    member public __.CountDic n (f : unit -> 'a) =
        let seqs = seq {for _ in 0 .. n - 1 -> f()}
        let dic = new Dictionary<'a, int64>();
        for i in seqs do
            if dic.ContainsKey(i)
            then dic.[i] <- dic.[i] + 1L
            else dic.Add(i, 1L)
        dic

end

[<EntryPoint>]
let main _ =
    let scanner = Scanner()
    let x = scanner.NextI64()
    let y = scanner.NextI64()
    let f x y = (x * y) - (2L * (x + y) - 4L)

    if x = 1L && y = 1L
    then 1L
    else if x = 1L || y = 1L
    then max x y |> (fun x -> x - 2L)
    else if x = 2L || y = 2L
    then 0L
    else f x y
    |> printfn "%i"

    0


Measured memory_bytes: 13916
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799;

string s;
int ans = 0;

int main(){
  cin >> s;
  string front, back;
  if(s.size() % 2 == 0){
    front = s.substr(0, s.size()/2);
    back = s.substr(s.size()/2);
  }else{
    front= s.substr(0, s.size()/2);
    back = s.substr(s.size()/2 + 1);
  }
  reverse(all(back));
  rep(i, s.size()/2){
    if(front.at(i) != back.at(i)) ans++;
  }
  cout << ans <<endl;
}

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

int main(){
      string S;
      cin >> S;
      int ans = 0;
      int a = S.length();
      for(int i = 0;i <=(a/2)-1;i++){
            if(S[i] != S[a-(i+1)]){
                  S[i] = S[a-i];
                  ans++;
            }
      }
      cout << ans << endl;
}


Measured memory_bytes: 256
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;

#define io ios_base::sync_with_stdio(false)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define mod 1000000007
#define pii pair<int, int>
#define PI 2*acos(0.0)
#define forn(i, n) for(int i = 0; i < n; i++)


int main()
{
    io;
    int n;
    cin>>n;
    ll inp[n];
    bool z = 0;
    forn(i, n)
    {
        cin>>inp[i];
        if(!inp[i])
            z = 1;
    }
    if(z)
        return cout<< "0\n", 0;
    ll ans = 1;
    forn(i, n)
    {
        if(inp[i] <= 1000000000000000000/ans)
            ans *= inp[i];
        else
        {
            ans = -1;
            break;
        }
    }
    cout<< ans<<"\n";
    return 0;
}


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

void Main()
{
    int64_t A;
    cin >> A;
    long double B;
    cin >> B;
    /*int64_t iB = B * 100;
    int64_t mul = A * iB;
    int64_t mod = mul % 100;

    cout << (mul - mod) / 100 << endl;*/
    cout << (int64_t)floorl((long double)A * B) << endl;
}

int main()
{
    Main();
}


Measured memory_bytes: 3788
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <iostream>
#include <set>
#include <utility>
#include <vector>

using namespace std;

int main(){
  int Nc = 0, Wc = 0, Sc = 0, Ec = 0;
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++){
    if (s[i] == 'N'){
      Nc++;
    }else if (s[i] == 'W'){
      Wc++;
    }else if (s[i] == 'S'){
      Sc++;
    }else if (s[i] == 'E'){
      Ec++;
    }
  }
  if ((Nc == 0) && (Sc == 0)){
    if ((Wc == 0) && (Ec == 0)){
      cout << "Yes" << endl;
    }else if ((Wc > 0) && (Ec > 0)){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }else if ((Nc > 0) && (Sc > 0)){
    if ((Wc == 0) && (Ec == 0)){
      cout << "Yes" << endl;
    }else if ((Wc > 0) && (Ec > 0)){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      // cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N, X;
  cin >> N >> X;
  vi A(N);
  cin >> A;
  int ans = 0;
  rep(i, 0, N) {
    if (A[i] > X) {
      ans += A[i] - X;
      A[i] = X;
    }
  }

  rep(i, 1, N) {
    int y = A[i - 1] + A[i] - X;
    if (y > 0) {
      A[i] -= y;
      ans += y;
    }
  }
  cout << ans << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 1024
from collections import Counter

N = [int(_) for _ in input().split()][0]
a = [int(_) for _ in input().split()]

s = [0] * (len(a) + 1)
for i in range(len(a)):
    s[i + 1] = s[i] + a[i]

c = Counter()

for i in range(len(s)):
    c[s[i]] += 1

ans = 0
for cnt in c.values():
    if cnt < 2: continue

    ans += (cnt * (cnt - 1)) // 2
print(ans)


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

int main() {
    ll n;cin>>n;
    map<ll,int> m;
    for (ll i=2;i*i<=n&&n>1;i++)
        while (n%i==0) {
            m[i]++;
            n/=i;
        }
    if (n>1)
        m[n]++;
    int ans=0;
    for (auto p:m)
        for (int i=1;i<=p.second;i++) {
            p.second-=i;
            ans++;
        }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
l,r = map(int,input().split())
ans = 2018
if r - l >= 2019:
    print("0")
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            temp = (i * j) % 2019
            ans = min(ans,temp)
    print(ans)

Measured memory_bytes: 9080
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <set>

using namespace std;

int main() {
    int n, q;
    string s;
    cin >> n >> s >> q;
    vector<set<int> > se(26);

    for (int i = 0; i < n; i++) {
        char c = s[i];
        se[c-'a'].insert(i+1);
    }

    for (int k = 0; k < q; k++) {
        int x;  cin >> x;
        if (x == 1) {
            int i;  char c; cin >> i >> c;
            se[s[i-1]-'a'].erase(i);
            s[i-1] = c;
            se[c-'a'].insert(i);
        }
        if (x == 2) {
            int ans = 0;
            int l, r;   cin >> l >> r;
            for (int j = 0; j < 26; j++) {
                if (se[j].empty())
                    continue;
                auto ite = se[j].lower_bound(l);
                int x = *ite;
                if (l <= x && x <= r)
                    ans++;
            }
            cout << ans << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 27228
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main() {
  string s;
  std::cin >> s;
  int sum=0;
  for (size_t i = 0; i < s.size()-1; i++) if(s[i]!=s[i+1]) sum++;
  std::cout << sum << std::endl;
  return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  cout<<(*max_element(a.begin(),a.end())-*min_element(a.begin(),a.end()))<<endl;
  return 0;
	
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void) {
	char ac = 'A';
    char wa = 'W';
    char tle = 'T';
    char re = 'R';
	char buf[10000];
	int n;
   	//printf("%c",ac1);
    fgets(buf, sizeof(buf), stdin);
	sscanf(buf, "%d", &n);
    //printf("%d\n",n);  
    

    char text[n][10];
    
    for(int i = 0; i < n; i++)
    {
    	
        scanf("%s", text[i]);
          	
        
    }
    /*for(int i = 0; i < n; i++)
    {
    	
        printf("%s\n",text[i]);
        
     	
    }*/
  	int ac1 = 0;
  	int wa1 = 0;
  	int tle1 = 0;
  	int re1 = 0;
  	
  	for(int i = 0; i < n; i++)
    {
    	if(text[i][0] == ac)
        {
          	ac1++;
        }
        else if(text[i][0] == wa)
        {
        	wa1++;
        }
      	else if(text[i][0] == tle)
        {
        	tle1++;
        }
      	else
        {
          	re1++;
        }
     	
    }
  	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n",ac1,wa1,tle1,re1);


 }

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

int A, B, C, X, Y;

int main() {
    cin >> A >> B >> C >> X >> Y;
    int ans = 0;
    int a;
    if( A + B < 2 * C) a = A + B; 
    else a = 2 * C;

    ans = X > Y ? a * Y + (X - Y) * A : a * X + (Y - X) * B;
    ans = X > Y ? min(ans, a * X) : min(ans, a * Y);
    
    cout << ans << endl;

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N+1);
  A[0] = 0;
  for(int i=1;i<N+1;i++) cin >> A[i];

  vector<int> dist(N+1);
  int total = 0;
  for(int i=0;i<N+1;i++) {
    dist[i] = abs(A[i]-A[(i+1)%(N+1)]);
    total += dist[i];
  }

  for(int i=1;i<N+1;i++) {
    cout << total - dist[i-1] - dist[i] + abs(A[(i+1)%(N+1)]-A[i-1]) << endl;
  }
}

Measured memory_bytes: 2048
A=int(input())
S=list(map(int,input().split()))
tmp=set()
aft=set()
for i in S:
   if i in aft:
      tmp.add(i)
   else:
      aft.add(i)
n=max(S)+1
DP=[1]*n
for i in aft:
   if i in tmp:
      DP[i]=0
   for j in range(2*i,n,i):
      DP[j]=0
ans=0
for i in S:
   ans+=DP[i]
print(ans)

Measured memory_bytes: 35832
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<numeric>

using namespace std;
typedef long long ll;
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 D = 1e9+7;
map<pair<ll, ll>, ll> mp;

ll f(ll S, ll X) {
    //cout << S << " " << X << endl;
    auto itr = mp.find(make_pair(S,X));
    if (itr != mp.end()) {
        return itr->second;
    }
    ll tmp = (f(S/2,X/2) + f((S-1)/2,(X-1)/2) + (f((S-2)/2,(X-2)/2))) % D;
    mp[make_pair(S,X)] = tmp;
    return tmp;
}

int main() {
    ll N; cin >> N;
    mp[make_pair(0,0)] = 1;
    //mp[make_pair(1,0)] = 1;
    mp[make_pair(1,1)] = 2;
    //mp[make_pair(2,0)] = 2;
    //mp[make_pair(-1,1)] = 0;
    ll res = f(N,N) % D;
    cout << res << endl;
}


Measured memory_bytes: 256
a=65280; b=61680; c=52428; d=43690; e=65535
def calc(s):
    res = eval(s.replace("-", "~").replace("*", "&").replace("1", "e"))
    return e ^ ~res if res < 0 else res
base = [a, b, c, d, e, 0]
L = {el: 1 for el in base}
for i in range(6):
    R = dict(L)
    for p in R:
        if R[p] < 16:
            L[p ^ e] = min(L.get(p ^ e, 16), R[p] + 1)
        if R[p]+3 < 16:
            for q in R:
                if R[p] + R[q] + 3 <= 16:
                    L[p & q] = min(L.get(p & q, 16), R[p] + R[q] + 3)
                    L[p ^ q] = min(L.get(p ^ q, 16), R[p] + R[q] + 3)
while 1:
    s = input()
    if s == '.':
        break
    print(L[calc(s)])

Measured memory_bytes: 7736
#include<stdio.h>
#define N 2000000

int A[N], B[N], C[N];

main(){

  int i, j, k=0, n;
  scanf("%d",&n);
  
  for(i=0; i<n; i++){
    scanf("%d", &A[i]);
    if(k < A[i]) k = A[i];
  }
  
  for(i=0; i<=k; i++){
    C[i]=0;
  }
  for(i=0; i<n; i++){
    C[A[i]]++;
  }
  for(i=1; i<=k; i++){
    C[i]=C[i]+C[i-1];
  }
  for(j=n; j>=0; j--){
    B[C[A[j]]-1]=A[j];
    C[A[j]]--;
  }
  
  
  for(i=0; i<n; i++){
    printf("%d", B[i]);
    if(i != n-1)
      printf(" ");
    else
      printf("\n");
  }
  return 0;
}

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

int main(){
    int n; cin >> n;
    vector<vector<pair<int, int>>> a(n);
    rep(i, n){
        int tmp; cin >> tmp;
        a[i].resize(tmp);
        rep(j, tmp){
            cin >> a[i][j].first >> a[i][j].second;
            a[i][j].first --; 
        }
    }
    int ans = 0;
    rep(b, (1<<n)){
        bitset<15> bit(b);
        bool check = true;
        int cnt = 0;
        rep(i, n){
            if (bit.test(i)){
                for (auto ai: a[i]){
                    if (ai.second == 1 && !(b & (1 << ai.first))) check = false;
                    else if (ai.second == 0 && (b & (1 << ai.first))) check = false;
                }
            }
        }
        rep(i, n){
            if (b & (1 << i)) cnt ++;
        } 
        if (check) ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
#include<cstdlib>
#include<cstdio>

int main(){
    int a[5][4][11]={0};
    int n;
    scanf("%d",&n);
    int i,j,k;
    int b,f,r,v;
    for(i=1; i<=n; i++){
        scanf("%d%d%d%d",&b,&f,&r,&v);
        a[b][f][r]+=v;
    }
    for(i=1; i<=4; i++){
        for(j=1; j<=3; j++){
            for(k=1; k<=10; k++){
                printf(" %d",a[i][j][k]);
            }
            printf("\n");
        }
        if(i!=4){
        for(k=1; k<=20; k++)
            printf("#");
        printf("\n");
        }
    }
    return 0;
}




Measured memory_bytes: 2752
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n, x, t;
  cin >> n >> x >> t;
  cout << ((n-1)/x+1)*t << endl;
  return 0;
}


Measured memory_bytes: 3620
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define all(x) x.begin(),x.end()

#define MOD 1000000007LL

#define int long long

int N,X,S[200];
int dp[200][100001];
bool already[200][100001] = {};
int solve(int now, int X){
	if(now == N-1) return X % S[now];
	if(already[now][X]) return dp[now][X];

	if(S[now] > X){
		dp[now][X] = (N-now)*solve(now+1,X);
	}
	else{
		dp[now][X] = (N-now-1)*solve(now+1,X);
		dp[now][X] %= MOD;
		dp[now][X] += solve(now+1,X%S[now]);
	}
	dp[now][X] = dp[now][X] % MOD;
	//cout << now << " " << X << " " << dp[now][X] << endl;
	already[now][X] = true;
	return dp[now][X];
}

signed main(){
	cin >> N >> X;
	for(int i=0; i<N; i++) cin >> S[i];
	sort(S,S+N);
	reverse(S,S+N);
	cout << solve(0,X) << endl;

	return 0;
}



Measured memory_bytes: 172928
#include<stdio.h>

int f[30];

int main(){
	for(int i=0;i<30;i++)f[i]=0;
	int N,M;
	scanf("%d%d",&N,&M);
	for(int i=0;i<N;i++){
		int K;
		scanf("%d",&K);
		for(int j=0;j<K;j++){
			int a;
			scanf("%d",&a);
			f[a-1]++;
		}
	}
	int ans=0;
	for(int i=0;i<M;i++)if(f[i]==N)ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
use std::io::prelude::*;

fn input<T>() -> T
where T: std::str::FromStr {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let a = input::<i32>();
    let b = input::<i32>();
    let c = input::<i32>();

    if b - a == c - b {
        println!("YES");
    } else {
        println!("NO");
    }
}

Measured memory_bytes: 4352