akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
//#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i <= n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i <= n; i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    
    v_int x(n);

    irep(i, n) {
        cin >> x[i];
    }

    ll ans = INF;
    irep2(i, 1, 100) {
        ll sum = 0;
        irep(j, n) {
            sum += (x[j] - i) * (x[j] - i);
        }
        ans = min(ans, sum);
    }

    cout << ans << endl;
    return 0;
}
/** atcoder **/


Measured memory_bytes: 256
N,M=sorted(map(int,input().split()))

if N==1 and M==1:
    print(1)
elif N==1 and M==2:
    print(0)
elif N==1 and M>=3:
    print(M-2)
elif N==2:
    print(0)
else:
    print((N-2)*(M-2))

Measured memory_bytes: 3060
H,W = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(H)]

res = []
for i in range(H-1):
    for j in range(W):
        if a[i][j]%2 !=0:
            a[i+1][j]+=1
            res.append((i+1,j+1,i+2,j+1))
for i in range(W-1):
    if a[-1][i]%2 !=0:
        a[-1][i+1] += 1
        res.append((H,i+1,H,i+2))
print(len(res))
for a,b,c,d in res:
    print(a,b,c,d)

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

using namespace std;

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

    string s;
    cin >> s;

    int cnt = 0;
    for(int i = 0; i < 3; i++)
    {
        if(s[i] != 'x')
            cnt++;
    }

    cout << 700 + cnt * 100;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

struct node{
	node *left;
	node *right;
	int key;
};

struct tree{
	node *nil;
	node *root;
};

void insert(tree *t, int id){
	node *x, *y, *n;
	n = new node;
	n->key = id;
	n->left = t->nil;
	n->right = t->nil;
	x = t->root;
	while(x != t->nil){
		y = x;
		if(id > x->key){
			x = x->right;
		}
		else{
			x = x->left;
		}
	}
	if(id > y->key){
		y->right = n;
	}
	else{
		y->left = n;
	}
}

void find(tree *t, int key){
	node *x, *y;
	x = t->root;
	char str[4];
	
	strcpy(str, "no");
	while(x != t->nil){
		if (x->key == key){
			strcpy(str, "yes");
			break;
		}
		else if (key > x->key){
			x = x->right;
		}
		else{
			x = x->left;
		}
	}
	printf("%s\n", str);
}

void printIn(tree *t, node *n){
	if (n == t->nil){
		return ;
	}
	else{
		printIn(t, n->left);
		printf(" %d", n->key);
		printIn(t, n->right);
	}
}

void printPre(tree *t, node *n){
	if (n == t->nil){
		return ;
	}
	else{
		printf(" %d", n->key);
		printPre(t, n->left);
		printPre(t, n->right);
	}
}


int main(void){
	tree *t;
	t = new tree;
	char str[10];
	int i,id,n;
	scanf("%d", &n);
	
	t->root = new node;

	t->root->left = t->nil;
	t->root->right = t->nil;
	
	for(i=0;i<n;i++){
		if(i==0){
			scanf("%s %d", str, &(t->root->key));
		}
		else{
			scanf("%s", str);
			if(str[0] == 'i'){
				scanf("%d", &id);
				insert(t, id);
			}
			else if(str[0] == 'p'){
				printIn(t, t->root);
				printf("\n");
				printPre(t, t->root);
                                printf("\n");
			}
			else{
				scanf("%d", &id);
				find(t, id);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 15068
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	string s;
	cin >> s;
	int cnt[26] = {};
	REP(i,s.length()){
		cnt[s[i] - 'A']++;
	}
	REP(i,26){
		if(!(cnt[i] == 0 || cnt[i] == 2)){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
// template.cpp

// Defines.
//#define DEBUG
#define NUMBER_OF_DIGITS 6

// Includes.
#include <bits/stdc++.h>

#ifdef DEBUG
#include <chrono>
#endif

// Usings.
using namespace std;

// Main function.
int main()
{
#ifdef DEBUG
	chrono::system_clock::time_point start, end;
	
	start = chrono::system_clock::now();
#endif
	
	// settings.
	ios::sync_with_stdio(false);
	
	//cout << fixed;
	//cout << setprecision(NUMBER_OF_DIGITS);
	
	// logic.
	string s;
	cin >> s;
	
	int max = 0;
	int counter = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if ((s[i] == 'A') || (s[i] == 'C') || (s[i] == 'G') || (s[i] == 'T'))
		{
			counter++;
		}
		else
		{
			if (counter > max)
			{
				max = counter;
			}
			counter = 0;
		}
	}
	
	if (counter > max)
	{
		max = counter;
	}
	
	cout << max << endl;

#ifdef DEBUG
	end = chrono::system_clock::now();
	
	double elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
	cout << elapsed << "[ms]" << endl;
#endif
	
	return 0;
}


Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
g = [[] for _ in range(n)]
for i in range(n-1):
    a, b = na()
    g[a-1].append(b-1)
    g[b-1].append(a-1)

def dfs(cur, pre, g, par, od):
    par[cur] = pre
    od.append(cur)
    for e in g[cur]:
        if e == pre: continue
        dfs(e, cur, g, par, od)

par = [-1] * n
od = []
dfs(0, -1, g, par, od)

def lca(a, b, par):
    ps = set()
    q = a
    while q != -1:
        ps.add(q)
        q = par[q]
    while b != -1:
        if b in ps:
            return b
        b = par[b]
    raise

m = ni()
cons = [0] * n
for i in range(m):
    u, v = na()
    u -= 1
    v -= 1
    lc = lca(u, v, par)
    while u != lc:
        cons[u] |= 1<<i
        u = par[u]
    while v != lc:
        cons[v] |= 1<<i
        v = par[v]

def st(b, m):
    # b = copy(a)
    for i in range(m):
        for j in range(1<<m):
            if (j>>i&1) == 0:
                b[j|1<<i] += b[j]
    return b

def ist(b, m):
    # b = copy(a)
    for i in range(m):
        for j in range(1<<m):
            if (j>>i&1) == 0:
                b[j|1<<i] -= b[j]
    return b

dp = [1] * (1<<m)
for cur in range(1,n):
    for i in range(1<<m):
        if (i&cons[cur]) == cons[cur]:
            dp[i] *= 2

# dp = [None for _ in range(n)]
# for i in range(n-1,-1,-1):
#     cur = od[i]
#     my = [0] * (1<<m)
#     my[0] = 1
#     if cur != 0:
#         my[cons[cur]] += 1
#     my = st(my, m)
#
#     for e in g[cur]:
#         if e == par[cur]: continue
#         for j in range(1<<m):
#             my[j] = my[j] * dp[e][j]
#     dp[i] = my

    # dp[i] = ist(my, m)

dp = ist(dp, m)

print(dp[(1<<m)-1])


Measured memory_bytes: 50632
from itertools import permutations
h,w=map(int,input().split())
d=[list(map(int,input().split())) for i in range(10)]

def warshall_floyd(d):
    n=len(d)
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
d=warshall_floyd(d)
cost=[d[i][1] for i in range(10)]

from collections import defaultdict
count=defaultdict(int)
for i in range(h):
    A=list(map(int,input().split()))
    for a in A:
        count[a]+=1

ans=0
t=[x for x in range(10) if x!=1]
for i in t:
    ans+=cost[i]*count[i]
print(ans)

Measured memory_bytes: 40556
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i< n; i++) {
        cin >> a[i];
    }
    int cou = 0;
    for(int i = 0; i < n; i++) {
        if(a[a[i] - 1] - 1 == i) cou++;
    }
    cout << cou / 2 << endl;
}


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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);
constexpr long long MOD(long long in) {
	return in % mod;
}

int n;
ll a[100005];
int main()
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);

	std::cin >> n;

	ll sum = 0;
	for (int i = 0; i < n; i++) {
		std::cin >> a[i];
		sum += a[i];
	}

	if (sum % (((ll)n) * (n + 1) / 2) != 0) {
		std::cout << "NO" << std::endl;
		return 0;
	}

	ll cnt = 0;
	ll k = sum / (((ll)n) * (n + 1) / 2);
	for (int i = 0; i < n; i++) {
		auto val = a[(i + 1) % n] - a[i] - k;

		if (val > 0 || (-val) % n != 0) {
			std::cout << "NO" << std::endl;
			return 0;
		}
		cnt += (-val) / n;
	}

	if (cnt == k)
		std::cout << "YES" << std::endl;
	else
		std::cout << "NO" << std::endl;

	return 0;
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y_chenxiaoyan_1
#define y0			y_chenxiaoyan_0
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
int n=read(),m=read(),q=read();
int a[55],b[55],c[55],d[55];
int x[15],ans=0;
inline void dfs(int cur){
	if(cur==n+1){
		int sum=0;
		fz(i,1,q){
			if(x[b[i]]-x[a[i]]==c[i])	sum+=d[i];
		}
		ans=max(ans,sum);
		return;
	}
	fz(i,x[cur-1],m){
		x[cur]=i;
		dfs(cur+1);
	}
}
signed main(){
	x[0]=1;
	fz(i,1,q)	cin>>a[i]>>b[i]>>c[i]>>d[i];
	dfs(1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3624
///#pragma GCC optimize("O3,unroll-loops")
///#pragma GCC target("avx,avx2,fma")

#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;
#define ll long long
#define ull unsigned long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 200005
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define mod 998244353
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(ll N, ll pos){return (bool)(N & (1LL<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll fast_exp(ll x, ll n, ll m)
{
    ll res = 1;
    while(n>0)
    {
        if(n%2==1)
            res = (res * x) % m;
        x = (x * x) % m;
        n/=2;
    }
    return res%m;
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet1;

const int N = 200005;
ll f[N];

void fact()
{
    f[0] = 1;
    f[1] = 1;
    for(ll i = 2; i < N; i++)
        f[i] = (i * f[i-1])%MOD;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    FASTIO;
    fact();
    int n, k;
    cin>>n>>k;
    ll sum = 0;
    for(ll i = k; i <= n+1; i++)
    {
        ll mn = (i * (i-1LL)) / 2LL;
        ll mx = ((ll)n * i) - (i * (i - 1LL))/2LL;
        //error(mn, mx);
        sum+=(mx - mn + 1LL);
        sum%=MOD;
    }
    cout<<sum<<endl;

    //End();
    return 0;
}


Measured memory_bytes: 5224
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

typedef vector<vector<LL>> mat;

mat mul(mat A,mat B){
    mat C(A.size(),vector<LL> (B[0].size()));
    for(int i=0;i<A.size();i++){
        for(int k=0;k<B.size();k++){
            for(int j=0;j<B[0].size();j++){
                C[i][j]=(C[i][j]+A[i][k]*B[k][j])%mod;
            }
        }
    }
    return C;
}

mat pow(mat A,LL n){
    mat B(A.size(),vector<LL> (A.size(),0LL));
    for(int i=0;i<A.size();i++){
        B[i][i]=1;
    }
    while(n>0){
        if(n&1) B=mul(B,A);
        A=mul(A,A);
        n>>=1;
    }
    return B;
}



int main(){
    LL l,a,b;cin >> l >> a >> b >> mod;
    LL t=10;
    vector<LL> x;
    x.pb(0);
    for (int i = 1; i <= 18; i++) {
        x.pb(max(0LL,min(l,(t-a+b-1)/b)));
        t*=10;
    }
    vector<P> v;
    for (int i = 1; i < x.size(); i++) {
        v.pb(P(x[i]-x[i-1],i));
    }
    LL ans = 0,num = a;
    mat C(3,vector<LL> (3,0));
    C[0][1] = 1;
    C[1][1] = 1;
    C[1][2] = b;
    C[2][2] = 1;
    for (int i = 0; i < v.size(); i++) {
        LL k=1;
        for (int j = 0; j < v[i].sc; j++) k=k*10%mod;
        C[0][0] = k;
        vector<LL> h{ans,num,1};
        auto p = pow(C,v[i].fs);
        vector<LL> c(3,0);
        for (int j = 0; j < 3; j++) {
            for (int s = 0; s < 3; s++) {
                c[j] = (p[j][s]*h[s]%mod + c[j])%mod;
            }
        }
        ans = c[0];
        num = c[1];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {

    private static Scanner sc;

    public static void main(final String[] args) {
        final Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null)
                br.close();
        }

        public String next() throws IOException {
            if (i < s.length)
                return s[i++];
            String st = br.readLine();
            while (st == "")
                st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }

    private void solve() {
        try {
            int a;
            int b;
            a = sc.nextInt();
            b = sc.nextInt();
         System.out.println(a*b);
            
        } catch (

        final Exception e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 32664
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    a_list.sort()
    print(abs(a_list[0] - a_list[-1]))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3700
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main(){
    int N;
    cin >> N;
    ll X;
    cin >> X;
    vector<ll> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    sort(all(A));
    int sum = 0;
    for(ll a : A){
        if(X >= a){
            X -= a;
            sum++;
        }else{
            X = 0;
            break;
        }
    }
    if(X == 0) cout << sum << endl;
    else cout << sum - 1 << endl;
}

Measured memory_bytes: 256
// Marcin Knapik
#include<bits/stdc++.h>
// #pragma GCC optimize("O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp> // order_of_key
// #include <ext/pb_ds/tree_policy.hpp> // find by order
// using namespace __gnu_pbds; 
// #define ordered_set tree< int , null_type,less< int >, rb_tree_tag,tree_order_statistics_node_update>  

// const ll MAX_LL = 0xFFFFFFFFFFFFFFFF;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// #define losuj(a, b) uniform_int_distribution<ull>(a, b)(rng)

typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;

#define boost                   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define f                       first
#define s                       second

template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}

template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template<class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template<class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<class T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }

const ll INF = 1e9 + 7;
const ll mod = 1186782211;
// const ll BIG_INF = 1000000000000000000;
const ll BIG_INF = 15000000000000;
const ll N = 1e6+7;
const ll T = 1<<20;
const ll Hope = 1000000123;

ll n, m, k, q;	

bool palindrome(string s){
	for(int i = 0 ; i < sz(s); i++)
		if(s[i] != s[sz(s) - 1 - i])
			return false;
	return true;
}

int main(){
	boost;

	string s;
	cin >> s;

	cout << (palindrome(s) and palindrome(s.substr(0, (sz(s)-1)/2)) and palindrome(s.substr((n+1) / 2, n - (sz(s)+3)/2)) ? "Yes\n" : "No\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) x.begin(),x.end()
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;



void Main(){

  int N;
  cin >> N;

  rep(i,N-1){
    reps(j,i+1,N){
      int x=i; int y=j;
      int z=x^y;
      rep(k,10){
        if(z>>k&1){
          cout << k+1 <<" ";
          break;
        }
      }
    }
    cout <<"\n";
  }
}


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


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    int r,D,x,y = 0;
    cin >> r >> D >> x;
    for(int k = 0; k < 9; k++){
        if(k==0){
        y = r*x - D;
        cout << y << endl;}

        y = y*r - D;
        cout << y << endl;
    }
}

Measured memory_bytes: 256
using System;
 
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
      int num=int.Parse(Console.ReadLine());
    string[] str=Console.ReadLine().Split(' ');
      double ans=0;
      double sum=0;
      for(int i=0;i<num;i++){
        double N=double.Parse(str[i]);
        sum+=(1/N);
    }
    ans=(1/sum);
      Console.WriteLine(ans);
  }
  }
}

Measured memory_bytes: 11092
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  

// type
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;

// define & const valur
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI; 
#define DIV int(1e9+7)
// for debug 
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
// useful func
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
 
/* Coding Space*/
double dp[40000]={}; //dp[t*2] = max speed
int main(){
  int n;  cin >> n;
  vi t(n),v(n);
  rep(i,n)  cin >> t[i]; rep(i,n)  cin >> v[i];
  rep(i,n)  t[i] *= 2,v[i] *= 2;
  rep(i,40002)
    dp[i] = double(i);
  
  int sum_t = 0;
  rep(i,n){
    for(int j = sum_t; j >= 0; j--)
      dp[j] = min(dp[j],v[i]+double(abs(sum_t-j)));
    for(int j = sum_t; j <= sum_t + t[i]; j++)
      dp[j] = min(dp[j],(double)v[i]);
    sum_t += t[i];
    for(int j = sum_t; j <= 40000; j++)
      dp[j] = min(dp[j],v[i]+double(abs(sum_t-j)));
  }
  for(int i = sum_t; i >= 0; i--)
    dp[i] = min(dp[i],double(sum_t - i));
  double ans = 0.;
  for(int i = 0; i <= sum_t; i++){
    ans += dp[i];
    //cerr << dp[i] << endl;
  }
  cout <<fixed<<setprecision(10)<< ans/4. << endl;
}

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

using namespace std;
using ll = long long;

struct UnionFind {
	vector<int> par;
	vector<int> r;
	vector<ll> Size;

	UnionFind(size_t sz) {
		par.resize(sz);
		r.resize(sz, 0);
		Size.resize(sz, 1);
		for (int i = 0; i < sz; ++i) { par[i] = i; }
	}

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

	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) { return ; }

		if (r[x] < r[y]) {
			par[x] = y;
			Size[y] += Size[x];
		} else {
			par[y] = x;
			Size[x] += Size[y];
			if (r[x] == r[y]) { ++r[x]; }
		}
	}

	bool same(int x, int y) { return find(x) == find(y); }
};

int main() {
	ll N, M;
	cin >> N >> M;
	vector<int> a(M);
	vector<int> b(M);
	for (int i = 0; i < M; ++i) {
		cin >> a[i] >> b[i];
	}

	UnionFind uf(N + 1);
	vector<ll> res(M, 0);
	res[M - 1] = (N - 1) * N / 2;
	for (int i = M - 1; i > 0; --i) {
		if (uf.same(a[i], b[i])) {
			res[i - 1] = res[i];
			continue;
		}
		ll s = uf.Size[uf.find(a[i])];
		ll t = uf.Size[uf.find(b[i])];
		res[i - 1] = res[i] - (s * t);
		uf.unite(a[i], b[i]);
	}

	for (int i = 0; i < M; ++i) {
		cout << res[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
string Yes[2] = {"Yes", "No"};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

using Graph = vector<vector<int>>;
Graph G;

/*------------------------------------------------------------------*/

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

    int n; cin >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];

    bool flag = false;
    rep(i, n - 2){
        if(a[i] == b[i] and a[i + 1] == b[i + 1] and a[i + 2] ==  b[i + 2]){
            flag = true;
        }
    }
    if(flag) cout << Yes[0] << endl;
    else cout << Yes[1] << endl;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
	for(;;){
		int n;
		int point_a = 0, point_b = 0;
		cin >> n;
		if(n == 0) break;
		for(int i = 1; i <= n; i++){
			int a, b;
			cin >> a >> b;
			if(a > b) point_a += (a + b);
			else if(a < b) point_b += (a + b);
			else if(a == b){
				point_a += a;
				point_b += b;
			}
		}
		cout << point_a << " " << point_b << endl;
	}
	return 0;
}

Measured memory_bytes: 2960
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __
.' ____ \ [  |      (_)                [  |
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |,
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/

*/
/* }}} */

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

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* typedef */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int, int> pii;
typedef double D;
typedef complex<D> P;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T> void print(T x) {std::cout << x << '\n';}
template <typename T>
void print(std::vector<T>& v, std::string s = " ") {
  REP(i, v.size()) {
    if (i != 0) std::cout << s;
    std::cout << v[i];
  }
  std::cout << '\n';
}

/* }}} */

signed main()
{
  int n = in(), a = in(), b = in();
  vi t(n);
  REP(i, n) t[i] = in();
  int cnt = 0;
  REP(i, n) {
    if (a <= t[i] && t[i] < b) continue;
    ++cnt;
  }
  print(cnt);

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(i=0; i<n; i++)

int main(void)
{
	int a, b, c;
	scanf("%d%d", &a, &b);
	c = a-(2*b);
	if(c<0) printf("%d", 0);
	else printf("%d", c);
	return 0;
}

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

const int64_t MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int n;
  cin >> n;
  
  vector< vector<pair<int,int>> > tree(n);
  int color[n] = {};

  
  int u,v, w;
  for(int i=0;i<n-1;i++){
    cin >> u >> v >> w;
    u--;v--;
    tree[u].push_back(make_pair(v,w));
    tree[v].push_back(make_pair(u,w));
    color[i] = -1;
  }


  char flag[n] = {};
  queue<int> q;
  q.push(0);flag[0]=1;color[0]=1;
  while(!q.empty())
  {
    int node = q.front();q.pop();
    for(auto next:tree[node]){
      if(1==flag[next.first])continue;
      if(0==next.second%2){
        color[next.first] = color[node];
      }
      else{
        if(color[node]==1) color[next.first] = 0;
        else color[next.first] = 1;
      }
      flag[next.first] = 1;
      q.push(next.first);
    }
  }
  
  for(auto c:color){
    cout << c << endl;
  }
  
  return 0;
}



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

int main() {
  string s;
  cin >> s;
  int b=0;
  if(s[0] == s[1]){
    if(s[2] == s[3]  && s[0] != s[2])
      b=1;
  }
  if(s[0] == s[2]){
    if(s[1] == s[3]  && s[0] != s[1])
      b=1;
  }
  if(s[0] == s[3]){
    if(s[2] == s[1]  && s[0] != s[2])
      b=1;
  }
  if(b == 1)
    cout <<"Yes";
  else
    cout <<"No";
}

Measured memory_bytes: 256
# C - Reconciled?
import math
N, M = map(int,input().split())

S = math.factorial(min(N,M)) % 1000000007

ans = 0
if abs(N-M) > 1:
    ans = 0
elif abs(N-M) == 1:
    ans = S*S*max(N,M)
else:
    ans = S*S*2

ans = ans % 1000000007

print(ans)


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


using namespace std;

const int INF = 1e9;

int main () {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
  
    
    string w; cin >> w;
    map<char, int> m;
    for (int i = 0; i < (int) w.size(); ++i)
        m[w[i]]++;
    for (auto& x: m) {
        if (x.second%2) {
            cout << "No" << '\n'; goto done;
        }
    }

    cout << "Yes" << '\n';
    done: ;
    
    return 0;
}



Measured memory_bytes: 3636
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>

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


int main() {
	int N, K;
	map<int, int> am;

	scanf("%d%d", &N, &K);
	rep(i, N) {
		int A;
		scanf("%d", &A);
		am[A]++;
	}

	vector<int> av;
	for (auto a : am) {
		av.push_back(a.second);
	}

	sort(av.begin(), av.end());

	int ans = 0;

	rep(i, (int)av.size() - K) ans += av[i];

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 10748
n = int(input())
a = list(map(int, input().split()))

rate = [0] * 8
s = 0

for i in a:
    if i < 400:
        rate[0] = 1
    elif 400 <= i < 800:
        rate[1] = 1
    elif 800 <= i < 1200:
        rate[2] = 1
    elif 1200 <= i < 1600:
        rate[3] = 1
    elif 1600 <= i < 2000:
        rate[4] = 1
    elif 2000 <= i < 2400:
        rate[5] = 1
    elif 2400 <= i < 2800: 
        rate[6] = 1
    elif 2800 <= i < 3200:
        rate[7] = 1
    elif 3200 <= i:
        s += 1



    
ans1 = 8-rate.count(0)
ans2 = ans1+s
if ans1 == 0 and s != 0:
    ans1 = 1


print(ans1, ans2)


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int n,m;
	cin>>n>>m;
	cout<<(n==m?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = sorted([int(input()) for i in range(n)])

if n % 2 == 0:
    small = a[:(n//2)]
    big = a[(n//2):]
    ans = sum(big) * 2 - sum(small) * 2  - big[0] + small[-1]
    print(ans)

else:
    small = a[:(n//2)]
    big = a[(n//2):]
    ans = sum(big) * 2 - sum(small) * 2  - big[0] -big[1]

    small = a[:(n//2)+1]
    big = a[(n//2)+1:]
    ans = max(ans, sum(big) * 2 - sum(small) * 2 + small[-1] + small[-2])
    print(ans)


Measured memory_bytes: 8284
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1<<30;
//typedef long double ld;
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 dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
int main(){
  vector<set<int> > pls;
  int N;  cin>>N;
  string s; cin>>s;
  int Q;  cin>>Q;
  pls.assign(26, set<int>({inf}));
  rep(i,0,N) pls[s[i]-'a'].insert(i);
  rep(i,0,Q){
    int type; cin>>type;
    if(type==1){
      int j;  char c;
      cin>>j>>c;
      j--;
      auto pc = s[j];
      s[j] = c;
      pls[pc-'a'].erase(j);
      pls[c-'a'].insert(j);
    }else{
      int l,r;  cin>>l>>r;
      l--;
      int cnt=0;
      for(int c=0 ; c<26 ; c++){
        int k = *pls[c].lower_bound(l);
        int m = *pls[c].lower_bound(r);
        if(k<m) cnt++;
      }
      cout<<cnt<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 24196
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String string = scanner.next();
		
		String t = "CODEFESTIVAL2016";
		
		int count = 0;
		for (int i = 0; i < t.length(); i++) {
			if (t.charAt(i) != string.charAt(i))
				count++;
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 9044
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>
#include <iomanip>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<double, double> PD;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

const double pi = acos(-1.0);

struct point {
  int id;
  double x, y;
  bool operator<(const point &p) {
    if(x != p.x) return x < p.x;
    return y < p.y;
  }
  PD operator-(const point &p) const {
    return {x - p.x, y - p.y};
  }
};

ll det(const PD &p, const PD &q) {
  return p.first * q.second - p.second * q.first;
}

vector<point> convex_hull(const vector<point> &ps) {
  int n = ps.size();
  int k = 0;
  vector<point> qs(n * 2);
  REP(i,0,n) {
    while(k > 1 && det(qs[k-1] - qs[k-2], ps[i]-qs[k-1]) <= 0) {
      k--;
    }
    qs[k++] = ps[i];
  }
  for(int i = n-2, t = k; i >= 0; i--) {
    while (k > t && det(qs[k-1] - qs[k-2], ps[i] - qs[k-1]) <= 0) {
      k--;
    }
    qs[k++] = ps[i];
  }
  qs.resize(k - 1);
  return qs;
}

double dot(PD p, PD q) {
  return p.first * q.first + p.second * q.second;
}

double arg(PD p, PD q) {
  double norm = sqrt(dot(p, p) * dot(q, q));
  return acos(dot(p, q) / norm) / pi / 2.0;
}

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<point> ps(n);
  REP(i,0,n) {
    ps[i].id = i;
  }
  FOR(p,ps) {
    cin >> p.x >> p.y;
  }
  sort(ps.begin(), ps.end());
  vector<point> qs = convex_hull(ps);
  int k = qs.size();
  vector<double> ans(n, 0.0);
  REP(i,0,k) {
    int prev = (i - 1 + k) % k;
    int next = (i + 1) % k;
    PD v1 = qs[i] - qs[prev];
    PD v2 = qs[next] - qs[i];
    double t = arg(v1, v2);
    ans[qs[i].id] = t;
  }
  FOR(a,ans) {
    cout << setprecision(20) << a << endl;
  }
  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
colors = set()
cnt = 0
for i in range(N):
    for j in range(1, 9):
        if (j - 1) * 400 <= A[i] < j * 400:
            colors.add(j)
            break
    if 3200 <= A[i]:
        cnt += 1

col_len = len(colors)
print(max(col_len, 1), col_len + cnt)


Measured memory_bytes: 3060
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N,M=rl()
A=[0]*M
B=[0]*M
for i in range(M):
    A[i],B[i] = rl()

class UnionFind:
    def __init__(self,n):
        self.par = [-1 for i in range(n+1)]
    
    def find(self,x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def same_check(self,x,y):
        return self.find(x) == self.find(y)
    
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        w_x = -self.par[x]
        w_y = -self.par[y]
        if w_x > w_y:
            self.par[x] += self.par[y]
            self.par[y] = x
        else:
            self.par[y] += self.par[x]
            self.par[x] = y
        return w_x*w_y
        
ans = [0]*M
res = N*(N-1)//2
uf = UnionFind(N)
for i in range(M-1,-1,-1):
    ans[i] = res
    a,b = A[i],B[i]
    if not uf.same_check(a,b):
        res -= uf.union(a,b)

for i in range(M):
    print(ans[i])

Measured memory_bytes: 16984
#include<iostream>
#include <cstdlib>
using namespace std;
int main()
{
  long long int a,b;
  cin>>a>>b;
  if(abs(a-b)%2==0)
  {
   long long int sum=abs(a-b)/2;
    if(a>b)
    {
      cout<<abs(sum-a);
    }
    else
    {
      cout<<abs(sum-b);
    }
  }
  else
  {
    cout<<"IMPOSSIBLE";
  }
}

Measured memory_bytes: 256
sx, sy, tx, ty = [int(i) for i in input().split()]
dx = tx - sx
dy = ty - sy

ans = "U" * dy + "R" * dx + "D" * dy + "L" * dx
ans += "L" + "U" * (dy + 1) + "R" * (dx + 1) + "D"
ans += "R" + "D" * (dy + 1) + "L" * (dx + 1) + "U"

print(ans)

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

int main()
{
    int N;
    cin>>N;
    vector<string> S(N);
    for (string &s: S)
        cin>>s;

    int ans = 0;
    for (int A=0; A<N; A++)
    {
        bool ok = true;
        for (int i=0; i<N; i++)
            for (int j=0; j<N; j++)
                if (S[(i+A)%N][j] != S[(j+A)%N][i])
                    ok = false;
        if (ok)
            ans += N;
    }
    cout<<ans<<endl;
}


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

int main() {
  int k, a, b;
  cin >> k >> a >> b;

  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }

  cout << "NG" << endl;

  return 0;
}


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

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  s              second
#define  f              first
#define  dline          cout<<"///REACHED///\n";
#define  deb1(x)        cout<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cout<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cout<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll, ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9 + 7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  3e+3 + 8;

vll adj[MAXN]; ll visit[MAXN] = {};
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

//<<-----Declare Variable Here------->>//
int t = 1;
ll n, a[MAXN];
ll dp[MAXN][MAXN][2];
//<<-----Implement Functions Here---->>//
ll solve(ll L, ll R, ll m) {
    if (L > R) return 0;

    if (dp[L][R][m] != -1) return dp[L][R][m];

    ll ans;
    if (m == 0) {
        ans = -INF;
        ans = max(ans, a[L] + solve(L + 1, R, 1));
        ans = max(ans, a[R] + solve(L, R - 1, 1));
    } else {
        ans = INF;
        ans = min(ans, solve(L + 1, R, 0));
        ans = min(ans, solve(L, R - 1, 0));
    }

    return dp[L][R][m] = ans;
}

//<<-----Start of Main--------------->>//
void MAIN() {
    mset(dp, -1);
    ll sum = 0;
    cin >> n;
    foo(i, 1, n)cin >> a[i], sum += a[i];
    cout << 2 * solve(1, n, 0) - sum;
}

int main() {
    fastio; randomINIT;

    //cin>>t;
    while (t--) {
        MAIN();
    }

}

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

using ll = long long int;
using P = std::pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rag(con) std::begin(con), std::end(con)

constexpr int MAX = 1e6 + 10;
std::map<int, int> prms[MAX];

int main()
{
    int n;

    std::cin >> n;

    ll ans = 0;

    for (int i = 2; i <= n - 1; ++i)
    {

        int x = 2, y = i;

        while (x * x <= y)
        {
            if (y % x == 0)
            {
                prms[y] = prms[y / x];
                prms[y][x]++;
                break;
            }
            else
            {
                ++x;
            }
        }
        if (prms[i].empty())
        {
            prms[i][y]++;
        }

        ll res = 1;
        for (auto p : prms[y])
        {
            res *= p.second + 1;
        }
        ans += res;
    }

    std::cout << ans + 1 << std::endl;

    return 0;
}

Measured memory_bytes: 184272