akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			
			String S = scan.next();
			String T = scan.next();
			
			char[]s = new char[S.length()];
			s = S.toCharArray();
			char[]t = new char[S.length()];
			t = T.toCharArray();
			
			int count = 0;
			
			
			for(int i = 0;i<S.length();i++) {
				if(s[i]!=t[i])count++;
			}
			
			System.out.println(count);
			
			
		}
		
		
	}
		

	
}


Measured memory_bytes: 42836
I=lambda:list(map(int,input().split()))
p,n=I()
l=I()
ne=[]
ma=10**9+7
for i in range(n-1):
    ne.append(abs(l[i]-l[i+1]))
if l[-1]==p:
    ne.append(l[0]-l[-1])
else:    
    ne.append(l[0]+abs(p-l[-1]))
g=sum(ne)
for i  in ne:
    ma=min(ma,g-i)
print(ma)
    

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

typedef long long ll;

#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define AA(i) cout << i << endl;
#define AS(i) cout << i << " ";

const int INF = 1001001001;

const double PI = 3.14159;

using namespace std;

//vector<ll> memo(1000007, INF);

int main() {

    int n;
    cin >> n;

    int p[n];
    rep(i, n)
        cin >> p[i];

    int ans = 1;
    int mi = p[0];
    for (int i = 1; i < n; i++) {
        if (p[i] < mi) {
            ans++;
            mi = p[i];
        }
    }

    AA(ans);
}

Measured memory_bytes: 4420
N = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
num = sum(a)
for i in range(N):
  if a[i]<=b[i]:
    b[i] = b[i]-a[i]
    a[i]=0
    if a[i+1]<=b[i]:
      a[i+1]=0
    elif a[i+1]>b[i]:
      a[i+1] = a[i+1]-b[i]
  elif a[i]>b[i]:
    a[i] = a[i]-b[i]
#print(num,sum(a))
num = num-sum(a)
print(num)

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


int main() {

  string S, T;
  cin >> S >> T;
  int sSize = S.size();

  string ans = "Yes";

  for(int i=0;i<sSize;i++){
    if(S.at(i) != T.at(i)){
      ans = "No";
    }
  }

 cout << ans <<endl;

}

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

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define bs(v,val) binary_search(v.begin(),v.end(),val)
#define mod 1e9+7
#define ff first
#define ss second
#define fi(n) for(int i=0;i<n;i++)
#define fj(n) for(int j=0;j<n;j++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define m_p make_pair
#define endl '\n'

ll power(ll x, ll y, ll p)
{  
    ll res = 1;
    x = x % p;  
    if (x == 0) return 0;
    while (y > 0){  
        if (y & 1)  res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p); 
}
// ********** CODE STARTS HERE ****************//



int main()
{
	fastio;
    // int T;
    // cin >> T;
    // while(T--)
    // {

    // }
    string S, T;
    cin >> S >> T;
    int cnt = 0;
    for(int i=0;i<S.length();i++)
    {
        if(S[i]!=T[i])cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3888
#include<stdio.h>
int main(void)
{
	int n,i,a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i=n-1;i>=0;i--){
		printf("%d",a[i]);
		if(i)printf(" ");
	}
	printf("\n");

return 0;
}

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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    FOR(i, 0, s.size() - 1)FOR(j, i, s.size() - 1) {
        string keyence = s.substr(0, i) + s.substr(j);
        if(keyence == "keyence") {
            cout << "YES" << ln;
            return 0;
        }
    }
    cout << "NO" << ln;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x;
  cin >> x;
  
  for (int i = x; i > 0; i--) {
    for (int j = 2; j * j <= i; j++) {
      if (i % j != 0)
        continue;
      int temp = i, count = 0;
      while (temp % j == 0) {
        count ++;
        temp /= j;
      }
      if (temp == 1 && count >= 2) {
        cout << i << endl;
        return 0;
      }
    }
  }
  cout << 1 << endl;
}


Measured memory_bytes: 3632
import collections
 
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
BC = [list(map(int,input().split())) for i in range(Q)]
 
sum_ = sum(A)

# 要素の出現回数をカウント
counter = dict(collections.Counter(A))
# print(counter)
 
for i in range(Q):
    b, c = BC[i]
    if not b in counter:
        counter[b] = 0
    if not c in counter:
        counter[c] = 0
    cnt = counter[b]
    sum_ += (c-b)*cnt
    print(sum_)
    counter[b] -= cnt
    counter[c] += cnt

Measured memory_bytes: 114896
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k,q,t,curr,i;
    cin>>n>>k>>q;
    ll a[100001];
    for(i=1;i<=n;i++){
    	a[i]=k;
	}
	map<ll,ll>mp;
	curr=q;
	while(curr--){
		cin>>t;
		mp[t]++;
	}
	for(i=1;i<=n;i++){
		if(mp.find(i)==mp.end()){
			a[i]-=q;
		}else{
			a[i]=a[i]-(q-mp[i]);
		}
		if(a[i]<=0){
			cout<<"No"<<endl;
		}else{
			cout<<"Yes"<<endl;
		}
	}
    return 0;
}

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

int main() {
    int N;
    string s;
    bool isThree = true;
    cin >> N;

    for(int i = 0; i < N; i++) {
        cin >> s;
        if(s == "Y") {
            isThree = false;
            break;
        }
    }

    if(isThree) {
        cout << "Three" << endl;
    } else {
        cout << "Four" << endl;
    }
}


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

int k,ans;
int dif[12];
const int M = 10;

void rec(int d, int p){
  if(p==k){
    ans = d;
    return;
  }

  int rot = dif[p];
  if(rot == 0){
    rec(d,p+1);
    return;
  }
  if(d>=ans-1)return;

  rec(d+1,p+1);

  for(int i=p;i<k;i++){
    dif[i] = (dif[i]-rot)%M;
    rec(d+1,p+1);
  }
  for(int i=p;i<k;i++)dif[i] = (dif[i]+rot+M)%M;
}

int main(){
  while(cin >> k,k){
    string s,t;
    cin >> s >> t;
    for(int i=0;i<k;i++){
      dif[i] = ( (int)(t[i]-s[i]) + M ) % M;
    }

    ans = k;
    rec(0,0);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1204
function Main(input){
  var N = Number(input);
  var m = N*N;
  for(var i=1;i<N;i++){
    var is = String(i);
    var iNs = String(N-i);
    var tmp = 0;
    for(var j of is){
      tmp+=Number(j);
    }
    for(var j of iNs){
      tmp+=Number(j);
    }
    if(tmp<m){
      m=tmp;
    }
  }
  console.log(m);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;
using ll = long long;

int main()
{
  ll x, k, d, ans;
    
  cin >> x >> k >> d;
  
  ll count = abs(x / d);
  ll b = abs(x % d);
  ll sub_k = k - count;
  
  if (k > count) {
  	if (sub_k % 2 == 0) {
      ans = b;
    } else {
      ans = abs(d) - abs(b);
    }
  } else {
  	ans = abs(x) - (k * d);
  }
  
  cout << abs(ans) << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int N;
	cin >> N;

	bool flg = false;

	for (size_t i = 0; i <= 9; i++) {
		for (size_t j = 0; j <= 9; j++) {
			if (i * j == N) {
				flg = true;
			}
		}
	}

	yn(flg);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, x = 1;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    if (x < K) {
      x *= 2;
    } else {
      x += K;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 3588
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;


int main()
{
  int ma=-1,len,n,i,j,k,A,B,N,array[29]={0},uni[29]={0};
  char S[101];
  scanf("%d",&len);
  scanf("%s",S);
  for(i=0;i<strlen(S)-1;i++){
    for(j=0;j<29;j++){
      array[j] = 0;
      uni[j] = 0;
    }
    n = 0;
    for(j=0;j<=i;j++){
      array[S[j]-'a'] = 1;
    }
    for(k=j;k<strlen(S);k++)
      if(array[S[k]-'a'])
        uni[S[k]-'a'] = 1;
    for(j=0;j<29;j++)
      n += uni[j];
    ma = max(ma,n);
  }
  printf("%d\n",ma);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long

using namespace std;

const int MOD = 1000000007;

// 10
// 3 1 4 1 5 9 2 6 5 3

int main() {
  ll a;
  scanf("%lld", &a);

  ll ans = 0;
  ll current = 1;
  for (ll i = 0; i < a; i++) {
    ll n;
    scanf("%lld", &n);

    if (n == current) {
      current = n + 1;
    } else {
      ans++;
    }
  }

  if (ans == a) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}


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

#define ED return 0;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) long(pow(x,y))
const long long int mod = 1000000007;
unsigned long long int gcd(unsigned long long int a, unsigned long long int b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    for(int i = 0;i < N;i++){
        int dummy;
        cin >> dummy;
        X = max(dummy,X);
    }
    for(int i = 0;i < M;i++){
        int dummy;
        cin >> dummy;
        Y = min(dummy,Y);
    }
    if(X < Y){
        cout << "No War" << endl;
    }
    else{
        cout << "War" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n,i;
  cin >> n >> i;
  cout << n-i+1 << endl;
}

Measured memory_bytes: 256
N, C = map(int, input().split())
D = [list(map(int, input().split())) for i in range(C)]
line1 = [0]*C
line2 = [0]*C
line0 = [0]*C
for i in range(N):
  c = list(map(int, input().split()))
  for j in range(N):
    if (i+j)%3 == 0:
      line0[c[j]-1] +=+1
    if (i+j)%3 == 1:
      line1[c[j]-1] +=+1
    if (i+j)%3 == 2:
      line2[c[j]-1] +=+1
ans = float("inf")
#line0をi+1に、1をj+1に, 2をk+1にそろえよう
#print(line0,line1,line2)
for i in range(C):
  for j in range(C):
    if j !=i :
      for k in range(C):
        if k !=i and k!=j: 
#          print(i,j,k)
          curr = 0
          for l in range(C):
            curr += line0[l]*D[l][i]
            curr += line1[l]*D[l][j]
            curr += line2[l]*D[l][k]
#          print(curr)
          ans = min(ans, curr)
print(ans)

Measured memory_bytes: 3064
from fractions import gcd
inpl = lambda: list(map(int,input().split()))

class SegCalcTree:
    def __init__(self, value, N=0, calc=lambda x,y: x+y):
        M = max(len(value),N)
        N = 2**(len(bin(M))-3)
        if N < M: N *= 2
        self.N = N
        self.node = [None] * (2*N-1)
        for i, v in enumerate(value):
            self.node[i+N-1] = v
        self.calc = lambda x, y: x if y is None else y if x is None else calc(x,y)
        for i in range(N-2,-1,-1):
            left, right = self.node[2*i+1], self.node[2*i+2]
            self.node[i] = self.calc(left, right)

    def set_value(self, n, v):
        i = (self.N-1) + n
        self.node[i] = v
        while i > 0:
            i = (i-1)//2
            left, right = self.node[2*i+1], self.node[2*i+2]
            new = self.calc(left,right)
            if self.node[i] == new:
                break
            else:
                self.node[i] = new

    def get(self,
            a=0, b=-1,
            k=0, l=0, r=-1):
        if b < 0:
            b = self.N
        if r < 0:
            r = self.N
        if a <= l and r <= b:
            return self.node[k]
        elif r <= a or b <= l:
            return None
        else:
            left = self.get(a,b,2*k+1,l,(l+r)//2)
            right = self.get(a,b,2*k+2,(l+r)//2,r)
            return self.calc(left,right)

N = int(input())
A = inpl()
sct = SegCalcTree(A,calc=gcd)
ans = 0
for i in range(N):
    a = A[i]
    sct.set_value(i,None)
    c = sct.get()
    if c > ans:
        ans = c
    sct.set_value(i,a)
print(ans)

Measured memory_bytes: 103016
int main(void){
    char mojiretuS[10];
    int i,j=0,cnt=0,ATGC[10]={0},max; 
    scanf("%s",mojiretuS);
    for(i=0;i<10;i++){
        if(mojiretuS[i]=='A'||mojiretuS[i]=='T'||mojiretuS[i]=='G'||mojiretuS[i]=='C'){
           cnt++;
           if(i==9)ATGC[j]=cnt;
        }else if(i==9){ATGC[j]=cnt;
              cnt=0;
              j++;}
        else {ATGC[j]=cnt;
              cnt=0;
              j++;}
    }
    max=ATGC[0];
    for(j=1;j<10;j++){
       if(max<ATGC[j])max=ATGC[j];}
  
    printf("%d",max);
     
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
ll dp[5005][5005];
ll a[5005];
int main(){
	ll n, m; cin >> n >> m;
	if (n % 2 == 0){
		for (ll i = 1; i <= n / 2; i++) a[i] = i; 
		a[n / 2 + 1] = a[n / 2];
		for (ll i = n / 2 + 2; i < n; i++) a[i] = a[i - 1] - 1;
	}
	else{
		for (ll i = 1; i <= (n + 1) / 2; i++) a[i] = i;
		for (ll i = (n + 3) / 2; i < n; i++) a[i] = a[i - 1] - 1;
	}
	dp[0][0] = 1;
	for (ll i = 1; i < n; i++){
		for (ll j = 0; j <= n; j++){
			if (j < a[i]) dp[i][j] = dp[i - 1][j];
			else dp[i][j] = (dp[i - 1][j] + dp[i][j - a[i]]) % m;
		}
	}
	ll ans = 0;
	for (ll i = 0; i <= n; i++) (ans += (dp[n - 1][i] * (n - i))) %= m;
	cout << ans << endl;
}

Measured memory_bytes: 195712
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    const MAX: usize = 100_000;
    let is_prime = make_sieve_of_eratosthenes(MAX);
    let mut s: Vec<usize> = vec![0; MAX + 1];
    let mut i = 3;
    while i <= MAX {
        if is_prime[i] && is_prime[(i + 1) / 2] {
            s[i] = s[i - 2] + 1;
        } else {
            s[i] = s[i - 2];
        }
        i += 2;
    }

    let q: usize = iterator.next().unwrap().parse().unwrap();
    let mut result = String::new();
    for _ in 0..q {
        let l: usize = iterator.next().unwrap().parse().unwrap();
        let r: usize = iterator.next().unwrap().parse().unwrap();

        let sl = if l == 1 {
            0
        } else {
            s[l - 2]
        };
        let sr = s[r];
        result.push_str(&format!("{}\n", sr - sl));
    }
    return result.trim().to_string();
}

fn make_sieve_of_eratosthenes(max: usize) -> Vec<bool> {
    let mut is_prime = vec![true; max + 1];
    is_prime[0] = false;
    is_prime[1] = false;

    let mut i = 2;
    while i * i <= max {
        if is_prime[i] {
            let mut j = i * 2;
            while j <= max {
                is_prime[j] = false;
                j += i;
            }
        }
        i += 1;
    }

    return is_prime;
}


Measured memory_bytes: 8700
char s[9],a[6];main(){for(;~scanf("%*d,%s",s);a[(s[1]+s[0]-64)%10]++)s[1]-=s[1]?64:0;printf("%d\n%d\n%d\n%d\n",a[1],a[2],a[3],a[5]);exit(0);}

Measured memory_bytes: 0
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 1500


int main(){
	char a[N][N + 1];
	f(i, N){
		f(j, N + 1)a[i][j] = '.';
	}
	int n, m;
	int x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%d %d %d %d", &n, &m, &x, &y);
	if (n % 2 == 1){
		for (int j = 0; j < (m / 2); j++){
			if (x > 0){
				a[(n - 1)][(2 * j)] = '<';
				a[(n - 1)][(2 * j) + 1] = '>';
				x--;
			}
		}
	}
	if (n == 1 && y > 0){
		printf("NO\n");
		return 0;
	}
	if (m == 1 && x > 0){
		printf("NO\n");
		return 0;
	}

	if ((n % 2 == 1) && (m % 2 == 1) && (x % 2 == 1) && (n>1) && (m>1)){
		a[0][m - 2] = '<';
		a[0][m - 1] = '>';
      x--;
		for (int i = 0; i < (n / 2); i++){
			for (int j = 0; j < ((m / 2) - 1); j++){
				if (x > 0){
					a[(2 * i)][(2 * j)] = '<';
					a[(2 * i)][(2 * j) + 1] = '>';
					x--;
				}
				if (x > 0){
					a[(2 * i) + 1][(2 * j)] = '<';
					a[(2 * i) + 1][(2 * j) + 1] = '>';
					x--;
				}
			}
		}
		for (int i = 1; i < (n - 1); i++){
			if (x > 0){
				a[i][m - 2] = '<';
				a[i][m - 1] = '>';
				x--;
			}
		}
	}
	else{
		for (int i = 0; i < (n / 2); i++){
			for (int j = 0; j < (m / 2); j++){
				if (x > 0){
					a[(2 * i)][(2 * j)] = '<';
					a[(2 * i)][(2 * j) + 1] = '>';
					x--;
				}
				if (x > 0){
					a[(2 * i) + 1][(2 * j)] = '<';
					a[(2 * i) + 1][(2 * j) + 1] = '>';
					x--;
				}
			}
		}
	}
	for (int i = 0; i < m; i++){
		for (int j = 0; j < (n - 1); j++){
			if ((a[j][i] == '.') && (a[j + 1][i] == '.') && (y>0)){
				a[j][i] = '^';
				a[j + 1][i] = 'v';
				y--;
			}
		}
	}
	if ((x > 0) || (y > 0))printf("NO\n");
	else {
		printf("YES\n");
		for (int i = 0; i < n; i++){
			for (int j = 0; j < m; j++){
				printf("%c", a[i][j]);
			}
			printf("\n");
		}
	}
	return 0;
}


Measured memory_bytes: 3328
from collections import deque
n = int(input())
d = deque()
while(n):
    if(n%26 == 0):
        d.append("z")
        n = n//26 - 1
    else:
        d.append(chr(96+n%26))
        n//=26

while d:
    print(d.pop(),end="")

Measured memory_bytes: 64964
#include <stdio.h>
int main(void){
    int d;
    scanf("%d",&d);
    if (d==25){
        printf("Christmas\n");
    } else if (d==24){
        printf("Christmas Eve\n");
    } else if (d==23){
        printf("Christmas Eve Eve\n");
    } else if (d==22){
        printf("Christmas Eve Eve Eve\n");
    }
	return 0 ;
}

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

main(){
  int n,q;
  cin>>n;
  vector<int>v(n);
  r(i,n)cin>>v[i];
  cin>>q;
  while(q--){
    int a,l,r;
    cin>>a>>l>>r;
    if(a)cout<<*max_element(v.begin()+l,v.begin()+r)<<endl;
    else cout<<*min_element(v.begin()+l,v.begin()+r)<<endl;
  }
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse4")
#pragma GCC optimize("unroll-loops")
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
using namespace std;
int A[2][105],pre[2][105];
int main()
{
    // std::ios::sync_with_stdio(false);
    // cin.tie(0);
    // cout.tie(0);
	int n,i,maxi=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>A[0][i];
		pre[0][i]=pre[0][i-1]+A[0][i];
	}
	for(i=1;i<=n;i++){
		cin>>A[1][i];
		pre[1][i]=pre[1][i-1]+A[1][i];
	}
	for(i=1;i<=n;i++)
		maxi=max(maxi,pre[0][i]+pre[1][n]-pre[1][i-1]);
	cout<<maxi;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

// C - Multiple Gift
ll X, Y;
ll ans = 1;

int main(){
    cin >> X >> Y;

    ll xt = X*2;
    while(xt<=Y){
        xt*=2;
        ++ans;
    }

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




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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	ll n;
	cin >> n;

	vector<ll> b(n + 1);

	for (int i = 1; i <= n; i++) {
		ll a;
		cin >> a;
		b[i] -= a - i;
	}

	sort(begin(b) + 1, end(b));
	ll mid = b[(n + 1) / 2];

	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += abs(b[i] - mid);
	}

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


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main(){
    int H, W, N;
    cin >> H >> W >> N;
    vector<int> a(N);
    vector<vector<int>> b(H, vector<int>(W));
    for (int i = 0; i < N; i++){
        cin >> a.at(i);
    }
    queue<int> q;
    for (int i = 0; i < N; i++){
        for (int j = 0; j < a.at(i); j++){
            q.push(i + 1);
        }
    }
    int w = 0, h = 0;
    for (int i = 0; i < H * W; i++){
        int k = q.front();
        q.pop();
        b.at(h).at(w) = k;
        if (h % 2 == 0){
            if (w < W - 1){
                w++;
                continue;
            }
            else{
                h++;
            }
        }
        else {
            if (w > 0){
                w--;
                continue;
            }
            else{
                h++;
            }
        }
    }
    for (int y = 0; y < H; y++){
        for (int x = 0; x < W; x++){
            cout << b.at(y).at(x);
            if (x != W - 1) cout << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    if (i > s.size()) {
      break;
    }
    if (s[i-1] == 'B' && s[i] == 'C') {
      s = s.erase(i-1,1);
      s[i-1] = 'D';
      cnt++;
    }
  }
  n = s.size();
  int R[n];
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (s[0] == 'A') {
        R[0] = 1;
      } else {
        R[0] = 0;
      }
    } else {
      if (s[i] == 'A') {
        R[i] = R[i-1] + 1;
      } else if (s[i] == 'D') {
        R[i] = R[i-1];
      } else {
        R[i] = 0;
      }
    }
  }
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'D') {
      ans += R[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1412
use std::io::*;
use std::str::FromStr;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let a: u32 = sc.next();
    let b: u32 = sc.next();
    let c: u32 = sc.next();

    let mut sum: u32 = 0;
    let mut cnt = 0;
    while sum < c {
        sum += a;
        if cnt % 7 == 6 {
            sum += b;
        }
        cnt += 1;
    }
    println!("{}", cnt);
}

/* ========== Scanner ========== */

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }

    fn char(&mut self) -> char {
        self.next::<String>().chars().next().unwrap()
    }
}



Measured memory_bytes: 5028
#include <stdio.h>
#include <algorithm>
using namespace std;
int n, m, r[1000][1000], dp1[1000][1000], dp2[1000][1000]; bool isprime[1000001];
const int dx[4] = { -1, 0, 1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int main() {
	isprime[1] = false;
	for (int i = 2; i <= 1000000; i++) isprime[i] = true;
	for (int i = 2; i <= 1000000; i++) {
		if (isprime[i]) {
			for (int j = i + i; j <= 1000000; j += i) {
				isprime[j] = false;
			}
		}
	}
	while (true) {
		scanf("%d%d", &n, &m);
		if (n == 0 && m == 0) break;
		for (int i = 0; i < 1000; i++) {
			for (int j = 0; j < 1000; j++) {
				dp1[i][j] = -1, dp2[i][j] = -1, r[i][j] = -1;
			}
		}
		int c = 2, d = 0, x = 499, y = 500;
		for (int i = 1; i <= n; i++) {
			r[y][x] = i; d++;
			x += dx[c % 4];
			y += dy[c % 4];
			if (d == c / 2) c++, d = 0;
		}
		int sx, sy;
		for (int i = 0; i < 1000; i++) {
			for (int j = 0; j < 1000; j++) {
				if (r[i][j] == m) sx = j, sy = i;
			}
		}
		dp1[sy][sx] = isprime[m] ? 1 : 0, dp2[sy][sx] = isprime[m] ? m : 0;
		int res1 = dp1[sy][sx], res2 = dp2[sy][sx];
		for (int i = sy + 1; i < 1000; i++) {
			for (int j = 0; j < 1000; j++) {
				if (r[i][j] == -1) continue;
				int s1 = -1, s2 = -1;
				for (int k = -1; k <= 1; k++) {
					if (0 <= j + k && j + k < 1000) {
						if (dp1[i - 1][j + k] != -1) {
							if (isprime[r[i][j]]) {
								s1 = max(s1, dp1[i - 1][j + k] + 1);
								s2 = r[i][j];
							}
							else {
								if (s1 < dp1[i - 1][j + k]) {
									s1 = dp1[i - 1][j + k];
									s2 = dp2[i - 1][j + k];
								}
								else if (s1 == dp1[i - 1][j + k] && s2 < dp2[i - 1][j + k]) {
									s2 = dp2[i - 1][j - k];
								}
							}
						}
					}
				}
				if (j == sx && i == sy) continue;
				dp1[i][j] = s1;
				dp2[i][j] = s2;
				if (res1 < s1) {
					res1 = s1;
					res2 = s2;
				}
				else if (res1 == s1 && res2 < s2) {
					res2 = s2;
				}
			}
		}
		printf("%d %d\n", res1, res2);
	}
	return 0;
}

Measured memory_bytes: 15408
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int a[6],n;
  int sm;
  while(cin>>n&&n){
    a[0]=1;
    a[1]=2;
    a[2]=3;
    a[3]=5;
    a[4]=4;
    a[5]=6;
    sm=1;
    for(i=0;i<n;i++){
      string s;
      cin>>s;
      if(s=="North"){
	swap(a[3],a[0]);
	swap(a[0],a[1]);
	swap(a[1],a[5]);
      }else if(s=="East"){
	swap(a[2],a[0]);
	swap(a[0],a[4]);
	swap(a[4],a[5]);
      }else if(s=="West"){
	swap(a[4],a[0]);
	swap(a[0],a[2]);
	swap(a[2],a[5]);
      }else if(s=="South"){
	swap(a[1],a[0]);
	swap(a[0],a[3]);
	swap(a[3],a[5]);
      }else if(s=="Right"){
	swap(a[4],a[1]);
	swap(a[1],a[2]);
	swap(a[2],a[3]);
      }else if(s=="Left"){
	swap(a[2],a[1]);
	swap(a[1],a[4]);
	swap(a[4],a[3]);
      }
      sm+=a[0];
    }
    cout<<sm<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
result = []
while True:
    words = list(input())
    if words[0] == '-':
        for k in range(len(result)):
            print(result[k])
        break
    count = int(input())
    for i in range(count):
        h = int(input())
        for j in range(h):
            words.append(words[0])
            words.pop(0)
    result.append(''.join(words))


Measured memory_bytes: 5600
h,w,k=map(int,input().split())
a=[input() for _ in range(h)]
s=(0,0)
for i in range(h*w):
    x,y=divmod(i,w)
    if a[x][y]=='S':
        s=(x,y)
        break
from collections import deque
todo=deque([s])
inf=float('inf')
seen=[[inf]*w for _ in range(h)]
seen[s[0]][s[1]]=0
while todo:
    (x,y)=todo.popleft()
    for dx,dy in ((0,1),(0,-1),(1,0),(-1,0)):
        nx=x+dx
        ny=y+dy
        if 0<=nx<h and 0<=ny<w and a[nx][ny]!='#' and seen[nx][ny]>seen[x][y]+1:
            seen[nx][ny]=seen[x][y]+1
            if seen[nx][ny]<k:todo.append((nx,ny))
ans=h*w
for i in range(h*w):
    x,y=divmod(i,w)
    if seen[x][y]==inf:continue
    tmp=min(x,y,h-x-1,w-y-1)
    tmp=(tmp+k-1)//k
    ans=min(ans,tmp)
print(ans+1)

Measured memory_bytes: 85284
# -*- coding: utf-8 -*-
n = int(input())
a = sorted([int(x) for x in input().split()])

s = 0
k = -1
for i in range(n-1):
    s += a[i]
    if 2*s<a[i+1]:
        k = i

if k==-1:
    print(n)
else:
    print(n-k-1)


Measured memory_bytes: 14252
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <sstream>
#include <iostream>
#include <time.h>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
using namespace std;
struct A{
    int a[27];
    bool operator < (A const& _A) const
       {
            for(int i = 0; i < 27; i ++){
                if(a[i] < _A.a[i]) return true;
                else if(a[i] == _A.a[i]){
                    continue;
                }else{
                    return false;
                }
            }
            return false;
       }
};
map<A,int> m;

char c[100];
int main(){
    int n;
    s(n)
    A b;
    for(int i = 0; i < n; i ++){
        re(b.a,0);
        ss(c)
        //ps(c) pn
        int lenc = len(c);
        for(int j = 0; j < lenc; j ++){
            b.a[c[j]-'a'+1] ++;
        }
        m[b] ++;
        //p(m[b]) pn
    }
    map<A,int>::iterator iter;
    iter = m.begin();
    ll sum = 0ll;
    while(iter != m.end()) {
        ll x = (ll)(iter->second);
        sum += (x*(x-1ll))/2ll;
        //cout << iter->first << " : " << iter->second << endl;
        //p(iter->second) pk pld(sum) pn
        iter++;
    }
    pld(sum) pn

    return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vl>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

vector<P> prime_factor(int num) {
  vector<P> ret;
  for (int i=2; i*i<=num; ++i) {
    int count = 0;
    while (num%i == 0) {
      num /= i;
      ++count;
    }
    if (count != 0) ret.push_back(P(i, count));
  }
  if (num != 1) ret.push_back(P(num, 1));
  return ret;
}

void solve() {
  int N; cin >> N;

  map<int, int> prime;
  for (int i=2; i<=N; ++i) {
    for (auto p : prime_factor(i)) {
      prime[p.first] += p.second;
    }
  }
  
  map<int, int> power;
  vi div75 = {3, 5, 15, 25, 75};
  for (auto p : prime) {
    rep(i,5) {
      if (p.second + 1 < div75[i]) break;
      ++power[div75[i]];
    }
  }

  int ans = 0;
  ans += power[75];
  ans += power[25] * (power[3] - 1);
  ans += power[15] * (power[5] - 1);
  ans += power[5] * (power[5] - 1) * (power[3] - 2) / 2;
  cout << ans << endl;
  return;
}

int main() {
  solve();
  return 0;
}


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

using namespace std;

#define ii pair<int,int>
#define fi first
#define se second

#define FOR(a,b,c) for(int a=b, __c=c; a<=__c; ++a)

const int N=2e5+5;
int n,a[N],b[N];
int cnt[N],d[N],ans[N];

int32_t main(){
   ios_base::sync_with_stdio(false);
   cin.tie(0); cout.tie(0);

   cin>>n;
   FOR(i,1,n) cin>>a[i];
   FOR(i,1,n) cin>>b[i];
   FOR(i,1,n) cnt[a[i]]++, cnt[b[i]]++, d[b[i]]++;
   multiset<ii> s;
   FOR(i,1,n) if(d[i]) s.insert({cnt[i],i});
   FOR(i,1,n){
      auto p=*s.rbegin();
      s.erase(p);
      if(p.se==a[i]){
         if(s.empty()) return cout<<"No\n",0;
         p=*s.rbegin();
         s.erase(p);
         s.insert(make_pair(cnt[a[i]],a[i]));
      }
      s.erase(make_pair(cnt[p.se],p.se));
      d[p.se]--;
      cnt[p.se]--;
      if(d[a[i]]) s.erase({cnt[a[i]],a[i]});
      cnt[a[i]]--;
      if(d[p.se]) s.insert({cnt[p.se],p.se});
      if(d[a[i]]) s.insert({cnt[a[i]],a[i]});
      ans[i]=p.se;
   }
   cout<<"Yes\n";
   FOR(i,1,n) cout<<ans[i]<<' ';
}


Measured memory_bytes: 16876
// ConsoleApplication56.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
using namespace std;
int main()
{
    int x,k;
    cin >> k>>x;
    if ((k * 500) >= x)
        cout << "Yes\n";
    else
        cout << "No\n";
}



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

int main(){
  int i,j;ll cnt=0;
  double a,b,x;
  cin>>a>>b>>x;
  if(a*a*b<2*x){
    if(b-x/(a*a)<a/2)printf("%.10lf",(180/M_PI)*atan((b-x/(a*a))/(a/2)));
    else printf("%.10lf",90-(180/M_PI)*atan((a/2)/(b-x/(a*a))));
  }else{
    if(a*b*b<2*x)printf("%.10lf",(180/M_PI)*atan(a*b*b/(2*x)));
    else printf("%.10lf",90-(180/M_PI)*atan(2*x/(a*b*b)));
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.A";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}

int main()
{
//	cut here before submit 
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	ios_base::sync_with_stdio(0);
	int T, D; cin >> T >> D;
	int tA, tB; cin >> tA >> tB;
	int dA, dB; cin >> dA >> dB;

	double diff = 1e100;
	for (int i = 0; i <= D; i++ ){
		for (int j = 0; j <= D; j++ ){
			int vA = i*dA, vB = j*dB;
			int cur = vA + vB;
			if (cur > D || cur < 1 ) continue;
			double curT = (double)(tA*vA + tB*vB)/(double)(vA + vB);
			double diffT = abs (curT - T );
			diff = min (diff, diffT );
		} // end for
	} // end for
	printf ("%.8lf\n", diff );

#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif			
	return 0;
}

Measured memory_bytes: 1272
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var s = next(1);
  var map = xArray(0,2020);
  var x = 0, ans = 0, k = 1;
  map[0] = 1;
  for(var i = s.length; i--;){
    x += +s[i] * k;
    x %= 2019;
    k = k*10%2019;
    ans += map[x]++;
  }
  return ans;
}

Measured memory_bytes: 32656
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#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;

ll ceil(ll a, ll b) {  // a÷b以上の最小の整数
    if(b == 0) {
        return 0;
    }
    return (a+b-1)/b;
}
 
int main() {
    ll a, b;
    cin >> a >> b;

    if(b == 1) {
        out(0);
        re0;
    }

    out(ceil(b-1, a-1));
    re0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;



void main() {
    readln.chomp.count!"a == '2'".writeln;
}



























void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<vector>
#include<cmath>
#include<complex>
#include<string>
#include<algorithm>

using namespace std;

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main(void)
{
  int a,b;

  cin >> a >> b;


  if(b%a == 0){
    cout << (a+b) << endl;
    return 0;
  }

  cout << (b-a) << endl;


  return 0;
}


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

using namespace std;
using int64 = long;

// nCr = n! / (n-r)!r!
int64 nCr(int64 n, int64 r) {
    if (n <= r) return 1;
    __int128 nn = 1;
    __int128 rr = 1;
    for (__int128 i=0; i<r; i++) {
        nn *= n - i;
        rr *= i+1;
    }
    return nn / rr;
}

void power_solve(const int& n, const int& p, const vector<int>& cnt) {
    int64 ans = (1LL << cnt[0]);
    int64 tmp = 0;
    for (int64 i=p; i<=cnt[1]; i+=2) tmp += nCr(cnt[1], i);
    ans *= tmp;

    cout << ans << endl;
}

void solve(const int& n, const int& p, const vector<int>& cnt) {
    if (p == 1 && cnt[1] == 0) {
        cout << 0 << endl;
        return;
    }

    if (p == 0 && cnt[0] == n) {
        cout << (1LL << n) << endl;
        return;
    }

    cout << (1LL << (n-1)) << endl;
}

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

    vector cnt(2,0);
    for (const auto &item : a) cnt[item%2]++;
    solve(n, p, cnt);
}

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

bool check(char a, char b, char c) {
  if (a == c) return true;
  if (a == b) return true;
  if (b == c) return true;
  return false;
}

int main() {
  string s;
  cin >> s;
  if (s.size() == 2) { 
    if (s[0] == s[1]) {
      cout << "1 2" << endl;
    }
    else {
      cout << "-1 -1" << endl;
    }
    return 0;
  }
  for (int i = 0; i < s.size()-2; ++i) { 
    if (check(s[i], s[i+1], s[i+2])) {
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;
}



Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		String s=sc.next();
		boolean a=false,b=false;
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='A') {
				a=true;
			}else if(s.charAt(i)=='B') {
				b=true;
			}
		}
		System.out.println(a&&b? "Yes":"No");
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
/*int find(int a){
     if(a==par[a])return a;
     return par[a]=find(par[a]);
}
void unite(int a,int b){
     a=find(a),b=find(b);
     if(a==b)return ;
     par[b]=a;
}
ll modexpo(ll a,ll b)
{
     ll ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
*/
int main(){
    ll n;
    cin>>n;
    int res=0;
    ll m=n-1;
    for(ll i=1LL;i<=sqrt(n);i++){
              if(n%i==0){
                   ll t=n,d=i;
                   if(i>1LL){
                   while(t%d==0)t/=d;
                   if(t%d==1)res++;
                   } 
                   d=n/i;
                   t=n;
                   if(1LL*i*i!=n){
                        while(t%d==0)t/=d;
                        if(t%d==1)res++;
                   }
                   
                   
              }

    }
    for(int i=1LL;i<=sqrt(m);i++){
         if((m)%i==0){
              if(i>1LL)res++;
              if(1LL*i*i!=m)res++;
         }
    }
    cout<<res;
}
 
 
 
 

























Measured memory_bytes: 3676
#include <cstdio>
#include <algorithm>

int main() {

	int a[6];
	int i;
	int ans = 0;

	for (i = 0; i < 4; ++i) scanf("%d",&a[i]);

	std::sort(a, a + 4);
	ans += a[3] + a[2] + a[1];

	scanf("%d%d", &a[4], &a[5]);
	a[4] >= a[5] ? ans += a[4] : ans += a[5];

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


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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; }

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
}

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

int main() {
  int l, n;
  string s;
  cin >> l >> n >> s;
  long long oo = 0;
  long long len = s.length();
  int i;
  for (i = 1; i < s.length(); i++) {
    if (s.at(i - 1) == 'o' && s.at(i) == 'o') {
      oo++;
    }
  }
  for (i = 0; i < n; i++) {
    len = len + oo * 3;
    oo *= 2;
  }
  cout << len << endl;
  return 0;
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> vec(N);
    rep(i,N){
        cin >> vec[i];
    }
    int ans = 10000000;
    for (int i = -100; i <= 100; i++){
        int ans_sub = 0;
        rep(j,N){
            ans_sub += (i - vec[j]) * (i - vec[j]);
        }
        ans = min(ans,ans_sub);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from sys import exit, stdin

input = stdin.readline
import copy
from collections import deque, Counter

# import numpy as np


class BIT:
    def __init__(self, a=0):
        self.n = a
        self.d = [0] * (a + 1)

    def add(self, i, x=1):
        i += 1
        while i <= self.n:
            self.d[i] += x
            i += i & (-i)

    def sum(self, *i):
        if len(i) == 1:
            x = 0
            i += 1
            while i:
                x += self.d[i]
                i -= i & (-i)
            return x
        else:
            return sum(self, i[1] - 1) - sum(self, i[0] - 1)


class UnionFind:
    def __init__(self, N):
        # N = data size
        self.n = N
        self.parents = [-1] * N

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

    def union(self, x, y):
        # unite x and y
        rx = self.find(x)
        ry = self.find(y)

        if rx == ry:
            return False
        if -(self.parents[rx]) < -(self.parents[ry]):
            rx, ry = ry, rx
        self.parents[rx] += self.parents[ry]
        self.parents[ry] = rx
        return True

    def size(self, x):
        # size of group of x's root
        return -(self.parents[self.find(x)])

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

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

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

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

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


N, M = list(map(int, input().split()))

if M == 0:
    print(1)
    exit()


D = UnionFind(N)

for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    D.union(a, b)

num = [D.size(r) for r in D.roots()]

print(max(num))


Measured memory_bytes: 19524