akhauriyash/Code-Regression huggingface dataset:
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True  and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

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

import itertools
n = inn()
a = inl()
b = inl()
cms = itertools.combinations(list(range(n)),n//2)
mn = BIG
for cm in cms:
    ev = []
    od = []
    for i in range(n):
        if i not in cm:
            ev.append((a[i] if i%2==0 else b[i], i))
        else:
            od.append((a[i] if i%2==1 else b[i], i))
    ev.sort()
    od.sort()
    #ddprint(f"{ev=}")
    #ddprint(f"{od=}")
    p = []
    q = []
    for i in range(n):
        if i%2==0:
            p.append(ev[i//2][1])
            q.append(ev[i//2][0])
        else:
            p.append(od[i//2][1])
            q.append(od[i//2][0])
    #ddprint(f"{cm=}")
    #ddprint(f"{p=}")
    #ddprint(f"{q=}")
    ok = True
    for i in range(n-1):
        if q[i]>q[i+1]:
            ok = False
            break
    if not ok:
        continue
    x = 0
    for i in range(n//2):
        #ddprint(f"{i=}")
        m = p.index(i)
        tmp = p[m]
        for j in range(m,i,-1):
            p[j] = p[j-1]
        p[i] = tmp
        x += m-i
        #ddprint(f"{m=} {p=}")
        m = p.index(n-1-i)
        tmp = p[m]
        for j in range(m,n-1-i):
            p[j] = p[j+1]
        p[n-1-i] = tmp
        x += n-1-i-m
        #ddprint(f"{m=} {p=}")
    #ddprint(f"{x=}")
    mn = min(mn,x)
print(mn if mn<BIG else -1)


Measured memory_bytes: 75436
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

bool isPrime(ll n) {
	for (int i = 2; n >= i * i; ++i) {
		if(!(n % i))return false;
	}
  return true;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n;cin>>n;
  vector<int> a(n);rep(i,n)cin>>a[i];
  sort(all(a));
  int ans = INF;
  auto fun = [&](int i,int j){
    return power(i-a[j],2);
  };
  for(int i = a[0];i <= a[a.size()-1];++i){
    int tmp = 0;
    rep(j,a.size()){
      tmp += min(ans,fun(i,j));
    }
    ans = min(ans,tmp);
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
bool flag;
bool ask(int a,int b){
    cout<<"? "<<a<<" "<<b<<endl;
    char c;cin>>c;
    return c=='Y';
}
void Main(){
    int A,B;cin>>A>>B;
    if(A<=B){
        cout<<"Impossible"<<endl;
        return;
    }
    else{
        int n=A+B,honest=-1,num,a,b;
        vector<int> vec(n,0);
        For(i,0,n){
            /*For(i,0,n) cout<<vec[i]<<" ";
            cout<<endl;*/
            if(i==0){
                flag=ask(0,1);
                if(flag){
                    vec[0]=1;
                    vec[1]=2;
                }
                else{
                    vec[0]=-1;
                    vec[1]=-1;                    
                }
            }
            else{
                num=-1,a=0,b=-1;
                For(i,0,n){
                    if(num<vec[i]){
                        num=vec[i];
                        a=i;
                    }
                    if(vec[i]==0){
                        b=i;
                    }
                }
                if(a==b||b<0){
                    honest=a;
                    break;
                }
                else{
                    flag=ask(a,b);
                    if(flag){
                        if(vec[a]==0) vec[a]=1;
                        vec[b]=vec[a]+1;
                    }
                    else{
                        vec[a]=-1;
                        vec[b]=-1;
                    }
                }
            }
        }
        if(honest<0){
            num=-1;
            For(i,0,n){
                if(vec[i]>num){
                    num=vec[i];
                    honest=i;
                }
            }
        }
        For(i,0,n){
            if(ask(honest,i)) vec[i]=1;
            else vec[i]=0;
        }
        string st="! ";
        For(i,0,n) st+=('0'+vec[i]);
        cout<<st<<endl;
    }
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 724
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, K): (i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let x = (N / K).pow(3);
    let y = ((N + K / 2) / K).pow(3);
    let ans = if K % 2 == 0 { x + y } else { x };

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

Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
int main(void)
{
    string str;
    cin>>str;
    string shit = "";
    for (auto it : str)
        if (it != 'x')
            shit += it;
    string ss = shit;
    reverse(all(ss));
    if (ss != shit)
        return puts("-1") * 0;
    int n = str.length();
    vi pos;
    for (int i = 0;i < n;++i)
        if (str[i] != 'x')
            pos.pb(i);
    int sz = pos.size();
    pos.pb(n);
    vi s;
    s.pb(pos[0]);
    for (int i = 0;i < sz;++i)
        s.pb(pos[i + 1] - pos[i] - 1);
    sz = s.size();
    int ans = 0;
    for (int i = 0;i < sz - i - 1;++i)
        ans += abs(s[i] - s[sz - i - 1]);
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 1656
#include<stdio.h>
int main(){
int a,b,c,d=0,e=0,f,r,w;
int rc[101][101]={0},g[101]={0};
scanf("%d %d",&r,&c);
for(a=0;a<r;a++){
for(b=0;b<c;b++){
scanf("%d",&w);
rc[a][b]=w;
}
}
for(a=0;a<r+1;a++){
for(b=0;b<c+1;b++){
if(b==c&&a!=r){
printf("%d\n",d);
e+=d;
d=0;
}
else if(a!=r){
printf("%d ",rc[a][b]);
d+=rc[a][b];
g[b]+=rc[a][b];
}
if(a==r&&b==c){
printf("%d\n",e);
}
else if(a==r&&b<c){
printf("%d ",g[b]);

}
}
}
return 0;
}

Measured memory_bytes: 648
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){

    let n: usize = read_as_vec()[0];
    let s: Vec<char> = read_as_string().chars().collect::<Vec<char>>();

    let mut ans: u64 = 0;
    for i in 0..n{
        let tmp_s: Vec<char>;
        if i > 0{
            tmp_s = s.clone().into_iter().skip(i).collect::<Vec<char>>();
        }else{
            tmp_s = s.clone();
        }
        // println!("\ni = {}", i);
        let res: Vec<u64> = z_algorithm(&tmp_s);
        // println!("res = {:?}", res);
        let mut tmp_ans = 0;
        for j in 1..tmp_s.len(){
            if res[j] <= j as u64 {
                tmp_ans = cmp::max(tmp_ans, res[j]);
            }
        }
        //println!("tmp_ans = {}", tmp_ans);
        ans = cmp::max(ans, tmp_ans);
    }

    println!("{}", ans);

}

fn z_algorithm(v: &Vec<char>) -> Vec<u64>{
    let mut z: Vec<u64> = vec![0;v.len()];
    z[0] = z.len() as u64;
    let (mut i, mut j): (usize, usize) = (1, 0);
    while i < v.len(){
        while i + j < v.len() && v[j] == v[i+j]{
            j += 1;
        }
         z[i] = j as u64;
         if j == 0{
            i += 1;
            continue;
        }

        let mut k: usize = 1;
        while i+k < v.len() && (k + z[k] as usize) < j{
            z[i+k] = z[k];
            k += 1;
        }
        i += k;
        j -= k;
    }
    z
}


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

int main()
{
    string n;
    cin >> n;
    if (n.at(0) == n.at(2))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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


int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n)
    cin >> h[i];
  vector<int> dp(n, INT_MAX);
  dp[0] = 0;
  rep(i, n - 1)
    for (int j = i + 1; j < min(n, i + k + 1); j++)
      dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
  cout << dp[n-1] << endl;
  return 0;
}

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

int main(){
  string s;
  cin>>s;
  int a=0,z=0;
  for (int i = 0; i < s.size(); i++)
  {
    /* code */
    if (s[i]=='A')
    {
      /* code */
      a=i;
      break;
    }
    
  }
    for (int i = 0; i < s.size(); i++)
  {
    /* code */
    if (s[i]=='Z')
    {
      /* code */
      z=i;
    }
    
  }
  
  cout<<z-a+1<<endl;
  }

Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(void){
  int q;cin>>q;
  for(int i=0;i<q;++i){
    int c,a,n;
    cin>>c>>a>>n;
    int t=0;
    while(1){
    	if(n&&a&&c){
    		n--;a--;c--;++t;
    	}else if(a&&c>=2){
    		a--;c-=2;++t;
    	}else if(c>=3){
    		c-=3;++t;
    	}else{
    		break;
    	}
    }
    cout<<t<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
// "header" {{{
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <tuple>
#include <iomanip>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int int64_t
#define Fixed fixed << setprecision(10)
#define moke_pair make_pair
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1000000007;

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

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class T,class U> using umap = unordered_map<T,U>;

inline int64_t updiv(int64_t n,int64_t d){
    return ((n + d -1) / d);
}
/*
inline double Sqrt( const double &x) 
{
	double         xHalf = 0.5 * x;
	int64_t  tmp   = 0x5FE6EB50C7B537AAl - ( *(int64_t*)&x >> 1);
	double         xRes  = * (double*)&tmp;

	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	xRes *= ( 1.5 - ( xHalf * xRes * xRes ) );
	return xRes * x;
}
*/
// }}}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,W;
    cin >> N >> W;

    vector<int> w(N+1),v(N+1);
    vector<vector<int> > dp(N+1,vector<int>(W+1));

    reps(i,N){
        cin >> w[i] >> v[i];
    }

    reps(i,N){
        reps(j,W){
            if(j - w[i] >= 0) dp[i][j] = max({dp[i][j-1],dp[i-1][j-w[i]] + v[i],dp[i-1][j]});
            else dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
        }
    }

    cout << dp[N][W] << '\n';

    return 0;
}


Measured memory_bytes: 80256
from collections import deque
x = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
k = int(input())

for i in range(k):
  f = x.popleft()
  if(f % 10 != 0):	x.append(10 * f + f % 10 - 1)
  x.append(10 * f + f % 10)
  if(f % 10 != 9):	x.append(10 * f + f % 10 + 1)
print(f)    



Measured memory_bytes: 11908
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int a[3], p, q, r;
int main() {
	while (true) {
		cin >> a[0] >> a[1] >> a[2];
		sort(a, a + 3);
		if (a[0] + a[1] <= a[2]) { cout << p + q + r << ' ' << p << ' ' << q << ' ' << r << endl; break; }
		if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) { p++; }
		if (a[0] * a[0] + a[1] * a[1] > a[2] * a[2]) { q++; }
		if (a[0] * a[0] + a[1] * a[1] < a[2] * a[2]) { r++; }
	}
}

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

int main(void) {
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    vector<double> expected_sum(n + 1, 0.0);
    double ans = 0.0;

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

    for(int i = 0; i + k <= n; ++i){
        ans = max(ans, (double)(expected_sum[i + k] - expected_sum[i]));
    }
    printf("%.6lf\n", ans);

    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>

#define REP(i,n) for(int i = 0; i < (n); i++)
#define REPC(x,c) for(auto x:(c))
#define FOR(i, b, e) for(int i = (b); i < (e); i++)
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>

using namespace std;

int sameCount(VI cc1, VI cc2) {
	int c = 0;
	REP(i, 26) {
		if (cc1[i] > 0 && cc2[i] >> 0) {
			++c;
		}
	}
	return c;
}

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

	VI cc1(26,0);
	VI cc2(26,0);

	REPC(c, s) {
		int key = c - 'a';
		++cc1[key];
	}

	int val = 0;
	REPC(c, s) {
		int key = c - 'a';
		--cc1[key];
		++cc2[key];
		val = max(val, sameCount(cc1, cc2));
	}

	cout << val << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)

N, M = map(int, input().split())
root = [-1] * N

def parent(x):
    if root[x] < 0:
        return x
    root[x] = parent(root[x])
    return root[x]


def union(x, y):
    x_parent = parent(x)
    y_parent = parent(y)
    if x_parent == y_parent:
        return
    root[x_parent] += root[y_parent]
    root[y_parent] = x


def size(x):
    return -root[x]
    

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


max_size = 0
for i in range(N):
    max_size = max(size(i), max_size)

print(max_size)

Measured memory_bytes: 16340
import sys
from heapq import heappush, heappop
n,q=map(int,input().split())
a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True)
heap=[]
ans=[]
for i in range(q):
  d=int(input())
  while a and a[-1][0]<=d:
    e=a.pop()
    heappush(heap,(e[2],e[1]))
  while heap and heap[0][1]<=d:
    heappop(heap)
  if heap:
    ans.append(heap[0][0])
  else:
    ans.append(-1)

print(*ans, sep='\n')



Measured memory_bytes: 54640
s = input()
de_num = 0
le_num = 0
ans = [0]*(len(s)+1)

for i in range(len(s)):
    if s[i] == "<":
        de_num += 1
    else:
        de_num = 0
    ans[i+1] = de_num

s = s[::-1]
ans.reverse()

for i in range(len(s)):
    if s[i] == ">":
        le_num += 1
    else:
        le_num = 0
    ans[i+1] = max(le_num,ans[i+1])

print(sum(ans))

Measured memory_bytes: 23716
/*input
100 5
1
23
45
67
89
*/
/**
    Author: Kristopher Paul
    Date Created: 09-06-2019
    Contest Name:
                _/    _/   _/_/_/_/   _/   _/_/_/_/
               _/  _/     _/    _/   _/   _/
              _/_/       _/_/_/_/   _/   _/_/_/_/
             _/  _/     _/  _/     _/         _/
            _/    _/   _/    _/   _/   _/_/_/_/
**/
#include<bits/stdc++.h>
#define ll long long
#define int ll
#define pb push_back
#define INF 0x3f3f3f3f //0x3f3f3f3f = 63
#define MOD 1000000007
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    int n,m;
    cin >> n >> m;
    umap<int,bool> brok;
    FOR(i,0,m){
        int b;
        cin >> b;
        brok[b] = true;
    }
    int dp[n+1];
    dp[0] = 1;
    FOR(i,1,n+1){
        if(brok[i]){
            dp[i] = 0;
            continue;
        }else{
            int way = dp[i-1];
            if(i > 1){
                way += dp[i-2];
            }
            way %= MOD;
            dp[i] = way;
        }
    }
    cout << dp[n] << endl;
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}


Measured memory_bytes: 5156
/*
 * itikara.cpp
 *
 *  Created on: 2018/05/30
 *      Author: J01003
 */
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int m,f,r;
	while(1){
	while(1){
	cin>>m>>f>>r;
	if(m==-1&&f==-1&&r==-1){
		return 0;
	};
	if(m==0&&f==0){
				cout<<"F"<<endl;
				break;
			}
	if(m==-1){
		cout<<"F"<<endl;
		break;
	}
	if(f==-1){
				cout<<"F"<<endl;
				break;
			}
	if(m+f>=80){
		cout<<"A"<<endl;
		break;
	}
	if(m+f<80&&m+f>=65){
			cout<<"B"<<endl;
			break;
		}
	if(m+f<65&&m+f>=50){
				cout<<"C"<<endl;
				break;
			}
	if(m+f<50&&m+f>=30&&r>=50){
					cout<<"C"<<endl;
					break;
				}
	if(m+f<50&&m+f>=30){
				cout<<"D"<<endl;
				break;
			}
	if(m+f<30){
				cout<<"F"<<endl;
				break;
			}

	}
	}
	return 0;
}




Measured memory_bytes: 3084
//13-2 ??°???????????????
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
int main(){
    int N;
    cin >> N;

    int num[200][3] = {};
    int first[101] = {};
    int second[101] = {};
    int third[101] = {};
    for(int i=0; i<N; i++){
        cin >> num[i][0] >> num[i][1] >> num[i][2];
        first[num[i][0]]++;
        second[num[i][1]]++;
        third[num[i][2]]++;
    }

    for(int i=0; i<N; i++){
        int ans = 0;
        if(first[num[i][0]] == 1) ans += num[i][0];
        if(second[num[i][1]] == 1) ans += num[i][1];
        if(third[num[i][2]] == 1) ans += num[i][2];
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	int sz = s.size();
	int cost = 0;
	for( int i = 0; i < sz/2; ++i ){
		if( s[i] != s[sz-i-1] ) ++cost;
	}
	cout << cost << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var answer = 0;
            answer = 111 * ((n / 111) + (n % 111 > 0 ? 1 : 0));
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int a,b;cin>>a>>b;
  int ans=a*b;
  cout<<ans<<endl;
  return 0;
}


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

int main(){
  int N,M,C;
  cin >> N >> M >> C;
  vector<int> bs(M);

  for (int i_1 = 0; i_1 < M; i_1 ++) cin >> bs.at(i_1);

  vector<int> a_sum(N);
  
  for(int i_2 = 0; i_2 < N; i_2 ++){//a_sumのi_2要素に対して
    for(int j_2 = 0; j_2 < M; j_2 ++){
      int a;
      cin >> a;
      a_sum.at(i_2) += a*bs.at(j_2);
    }
  }

  int count;

  for (int i_3 = 0; i_3 < N; i_3 ++){
    if(a_sum.at(i_3) + C >0){
      count ++;
    }
  }

  cout << count <<endl;  

}

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


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

    int T = 1, num = 0;
    while (T < B) {
        T += A - 1;
        num++;
    }

    cout << num << endl;

    return 0;
}



Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main()
{
	int x,y,c,t;
    cin>>x;
    cin>>y;
    if(y%2!=0)
    {
        cout<<"No"<<endl;
        return 0;
    }
    c=2*x -y/2;
    t=y/2 -x;
    if(c>=0 && t>=0)
    cout<<"Yes";
    else
    {
        cout<<"No";
    }
    
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	ll sum = 0;
	vector<ll> a(n), ans(n);
	rep(i, n){
		cin >> a[i];
		sum += a[i];
	}
	for(int i = 1; i < n; i += 2){
		sum -= a[i] * 2;
	}
	for(int i = 0; i < n; i += 2){
		ans[i] = sum;
		sum += (a[(i + 1) % n] - a[i]) * 2;
	}
	
	sum = accumulate(all(a), 0ll);
	for(int i = n - 1; i > 0; i -= 2){
		sum -= a[i] * 2;
	}
	for(int i = 1; i < n; i += 2){
		ans[i] = sum;
		sum += (a[(i + 1) % n] - a[i]) * 2;
	}
	
	rep(i, n){
		cout << ans[i] << (i==n-1?"\n":" ");
	}
	
	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using vd = vector<double>;
using pi = pair<int, int>;
using pd = pair<double, double>;
using i64 = int64_t;
using u64 = uint64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

class DisjointSet {
 public:
  vi rank, p;

  DisjointSet() {}
  DisjointSet(int size) : rank(size, 0), p(size, 0) {
    REP(i, size) make_set(i);
  }

  void make_set(int x) {
    p[x] = x;
    rank[x] = 0;
  }

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

  void unite(int x, int y) { link(find_set(x), find_set(y)); }

  void link(int x, int y) {
    if (rank[x] > rank[y]) {
      p[y] = x;
    } else {
      p[x] = y;
      if (rank[x] == rank[y]) rank[y]++;
    }
  }

  int find_set(int x) {
    if (x != p[x]) {
      p[x] = find_set(p[x]);
    }
    return p[x];
  }
};

int main() {
  int n, q, com, x, y;
  cin >> n >> q;
  DisjointSet ds(n);
  REP(i, q) {
    cin >> com >> x >> y;
    if (com == 0)
      ds.unite(x, y);
    else if (com == 1)
      cout << (ds.same(x, y) ? 1 : 0) << endl;
  }
}


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

using namespace std;

int main(void){
    int sum = 0;
    int x; cin >> x;
    while(true){
        if(0 <= x - 500){
            sum += 1000;
            x -= 500;
        }else {
            break;
        }
    }
    while(true){
        if(0 <= x - 5){
            sum += 5;
            x -= 5;
        }else{
            break;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import Data.Foldable (foldMap)
import Data.List.Split
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
-- end of templete

f n s = if s==ns then (n,s) else f (n+1) ns
  where
    ns = map (length . flip filter s . (==)) s

main = do
    n <- getInt
    when (n/=0) $ do
        s <- getInts
        let (r, v) = f 0 s
        print r
        putStrLn $ sjoin v
        main

Measured memory_bytes: 4100
#include <iostream>

int main( int ac, char **av )
{
  int a,b,c;
  bool flag = false;
  
  std::cin >> a >> b >> c;
  
  if ( a == 7 && b == 5 && c == 5 ) {
  	flag = true;
  } else if ( a == 5 && b == 7 && c == 5 ) {
    flag = true;
  } else if ( a == 5 && b == 5 && c == 7 ) {
  	flag = true;
  }
  
  if( flag ) {
    std::cout << "YES" << std::endl;
  } else {
	std::cout << "NO" << std::endl;
  }
  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int x1, y1, x2, y2, x3, x4, y3, y4;
	cin >> x1 >> y1 >> x2 >> y2;
	x3 = x2 - (y2 - y1);
	y3 = y2 + (x2 - x1);
	x4 = x1 - (y2 - y1);
	y4 = y1 + (x2 - x1);
	cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << endl;

	return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class E
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var (N, P) = Scanner.Scan<int, int>();
            var S = Scanner.Scan<string>();
            var answer = 0L;
            if (P == 2 || P == 5)
            {
                for (var i = 0; i < N; i++)
                {
                    if ((S[i] - '0') % P == 0) answer += i + 1;
                }
            }
            else
            {
                var dict = new Dictionary<long, long>();
                dict[0] = 1;
                var current = 0;
                var digit = 1;
                for (var i = N - 1; i >= 0; i--)
                {
                    current = (current + (S[i] - '0') * digit) % P;
                    if (!dict.ContainsKey(current)) dict[current] = 0;
                    answer += dict[current];
                    dict[current]++;
                    digit *= 10;
                    digit %= P;
                }
            }

            Console.WriteLine(answer);
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 29576
/*Bismillahir Rahmanir Rahim*/
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector <long long> vll;
typedef pair<int, int> pii;
///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Macro Start-*-*-*-*-*-*-*--*-*-*-*-*/

#define Faster_IO              ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F                      first
#define S                      second
#define pb                     push_back
#define MP                     make_pair
#define sf                     scanf
#define pf                     printf
#define PI                     (2*acos(0))
#define to_radian(degree)      ((pi/180)*degree)
#define to_degree(radian)      ((180/pi)*radian)
#define SQ(a)                  (a)*(a)
#define SORT(x)                sort(x.begin(),x.end())
#define rSORT(x)               sort(x.rbegin(),x.rend())
#define SetPrint(a,x)          cout<<fixed<<setprecision(x)<<a<<endl
#define show(vec)              for (long long i=0; i<vec.size(); i++)cout << vec[i] << " ";
#define YES                    printf("YES\n")
#define NO                     printf("NO\n")
#define Yes                    printf("Yes\n")
#define No                     printf("No\n")
#define tc(n)                  int n; cin >> n; while(n--)
#define lcm(a,b)               ((a / __gcd(a,b) ) * b)
#define gcd(a,b)               __gcd(a,b)
#define all(vec)               vec.begin(), vec.end()
#define SUM(vec)               accumulate(vec.begin(), vec.end(), 0)
#define lines                  cout << "\n" <<"-------------------" <<"\n"
///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Macro END-*-*-*-*-*-*-*--*-*-*-*-*/

///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Template Start-*-*-*-*-*-*--*-*-*-*-*/

//template <class T> T isPrime(T n){if(n<=1)return 0;for(long long i=2;i*i<=n; i++)if(n%i==0)return 0;return 1;}
//template <class T> T bigmod(T X, T n, T M) {if (n==0) return 1;if (n%2) return ((X%M) * bigmod(X,n-1,M)) %M;else {long long int d = bigmod(X,n/2, M);return ((d%M) * (d%M))%M;}}

///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Template END-*-*-*-*-*-*-*--*-*-*-*-*/



int main()
{
    Faster_IO
    #ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
    #endif

    string s;
    cin >> s;

    if(s == "ABC") cout << "ARC" <<"\n";
    else if(s == "ARC") cout << "ABC" <<"\n";
    
}


Measured memory_bytes: 3628
#include <stdio.h>

int main() {

	int A, B, C, D;

	scanf("%d %d %d %d",&A,&B,&C,&D);

	if (A*B > C*D) {
		printf("%d\n",A*B);
	}
	else if (A*B < C*D) {
		printf("%d\n",C*D);
	}
	else {
		printf("%d\n",A*B);
	}

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true;} return false;}

long long a[110000];
long long dp[110000];
long long MOD = 1000000007;

int main() {
	rep(i,110000) dp[i]=0;
	dp[0] = 1;

	int n, m, num, prev_num;
        prev_num = -100;	
	cin >> n >> m;
	rep(i, n + 1) a[i] = true;
	rep(i, m) {
		cin >> num;
		if (num == prev_num + 1) {
			cout << 0 << endl;
			return 0;
		}
		a[num] = false;
		prev_num = num;
	}
	rep(i,n+1) {
		if(a[i+1]) {
			dp[i+1] += dp[i];
			dp[i+1] %= MOD;
		}
		if(a[i+2]) {
			dp[i+2] += dp[i];
			dp[i+2] %= MOD;
		}
	}
	cout << dp[n] << endl;
}


Measured memory_bytes: 5244
import sys
input=sys.stdin.readline
from scipy.sparse.csgraph import floyd_warshall
n,m,l=map(int,input().split())
table=[[0]*n for i in range(n)]
for i in range(m):
    a,b,c=map(int,input().split())
    table[a-1][b-1]=c
    table[b-1][a-1]=c
d=floyd_warshall(csgraph=table, directed=False, return_predecessors=False)

table2=[[0]*n for i in range(n)]
for i in range(n):
  for j in range(i+1,n):
    if d[i][j]<=l:
      table2[i][j]=1
      table2[j][i]=1
d2=floyd_warshall(csgraph=table2, directed=False, return_predecessors=False)
q=int(input())
for _ in range(q):
  s,t=map(int,input().split())
  if d2[s-1][t-1]==float("inf"):
    print(-1)
  else:
    print(int(d2[s-1][t-1])-1)

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) { cin1(x[i]); }
#define ncin2(n, x, y)      REP(i, 0, n) { cin2(x[i], y[i]); }
#define ncin3(n, x, y, z)   REP(i, 0, n) { cin3(x[i], y[i], z[i]); }
#define ncinp(n, p)         REP(i, 0, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }
#define ncin1_1(n, x)       REPE(i, 1, n) { cin1(x[i]); }
#define ncin2_1(n, x, y)    REPE(i, 1, n) { cin2(x[i], y[i]); }
#define ncin3_1(n, x, y, z) REPE(i, 1, n) { cin3(x[i], y[i], z[i]); }
#define ncinp_1(n, p)       REPE(i, 1, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    lli d,n;
    cin2(d,n);
    if (d == 0) {
        if (n == 100)
            cout << n+1 << endl;
        else
            cout << n << endl;
        return 0;
    }
    if (n == 100)
        cout <<  (n+1) *  (lli)pow(100, d) << endl;
    else
        cout <<  n *  (lli)pow(100, d) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define INF 100000
#define MAX 101
#define NIL -6
#define WHITE 0
#define GRAY 1
#define BLACK 2

int G[MAX][MAX];
int n;

void prim(){
  int i,j;
  int d[MAX];
  int pi[MAX];
  int color[MAX];
  int min,u,v,sum=0;

  for(i=0;i<n;i++){
    d[i] = INF;
    pi[i] = NIL;
    color[i] = WHITE;
  }

  d[0] = 0;

  while(1){
    min = INF;
    u = NIL;
    for(i=0;i<n;i++){
      if(color[i] != BLACK && d[i] < min){
        min = d[i];
        u = i;
      }
    }
    if(u == NIL){
      break;
    }
    color[u] = BLACK;
    for(v=0;v<n;v++){
      if(color[v] != BLACK && G[u][v] != INF){
        if(d[v] > G[u][v]){
          d[v] = G[u][v];
          pi[v] = u;
          color[v] = GRAY;
        }
      }
    }
  }
  for(i=0;i<n;i++){
    if(pi[i] != NIL)sum += G[i][pi[i]];
  }
  printf("%d\n",sum);
}

int main(){
  int e;
  int i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&e);
      if(e == -1){
        G[i][j] = INF;
      }else{
        G[i][j] = e;
      }
    }
  }

  prim();
  return 0;
}

Measured memory_bytes: 640
import numpy as np
N = int(input())

a = np.array(list(map(int,input().split())))
b = np.array(list(map(int,input().split())))

carries = [0]*30
for i in range(1,30):
    thres = pow(2,i)
    ra = np.sort(thres - (a % thres))
    rb = np.sort(b % thres)
    #r = sum([N-np.searchsorted(rb,a) for a in ra])
    r = np.sum(N-np.searchsorted(rb,ra))
    carries[i] = r

ans = 0
i = 0
for i in range(30):
    a1 = np.sum(a % 2)
    a0 = N - a1
    b1 = np.sum(b % 2)
    b0 = N - b1
    ans += ((a1*b0 + a0*b1 + carries[i]) % 2) << i
    a //= 2
    b //= 2

print(ans)
    










Measured memory_bytes: 38168
#include <stdio.h>
int main(void){
  int a,b,i;
  scanf("%d %d",&a,&b);
  for(i=1;i<=2000;i++){
    if((8*i/100==a)&&(10*i/100==b)){
      printf("%d\n",i);
      return 0;
    }
  }
  printf("-1\n");
  return 0;
}

Measured memory_bytes: 1720
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Deque<Integer> list = new ArrayDeque<Integer>();
//		Scanner scan = new Scanner(System.in);
		BufferedReader scan=new BufferedReader(new InputStreamReader(System.in));
		int decAmount = Integer.parseInt(scan.readLine());
		int totalTime = 0;
		int[] number = new int[decAmount];
		int check =0;
		String decree = "";


		for(int i=0; i<decAmount; i++){
			decree = scan.readLine();
			String[] gyou = decree.split(" ");
			///??????????????????
			if(gyou[0].equals("insert")){
//				System.out.println("add "+gyou[1]);
				list.offerFirst(Integer.parseInt(gyou[1]));
			}
			if(gyou[0].equals("delete")){
//				System.out.println("remove "+gyou[1]);
				list.removeFirstOccurrence(Integer.parseInt(gyou[1]));
			}
			if(gyou[0].equals("deleteFirst")){
				list.removeFirst();
			}
			if(gyou[0].equals("deleteLast")){
				list.removeLast();
			}
		}
		int times= list.size();
		for(int i=0;i<times;i++){
			System.out.print(list.poll());
			if(i == times-1){
				System.out.println("");
			}
			else{
				System.out.print(" ");
			}
		}
	}
}

Measured memory_bytes: 196184
##def tansaku(gen):
#    mada=False
#    keta=0
#    for i in range(n):
#        if(gen[i]==-1):
#            mada=True
#            keta=i
#    if(mada):
#        nex=gen
#        nex[keta]=0
#        tansaku(nex)
#        nex[keta]=1
#        tansaku(nex)
#    else:
#        print(gen)
#        return

n=int(input())
a=[]
sinrai=[]
for i in range(n):
    kai=int(input())
    a.append(kai)
    temp=[]
    for i in range(kai):
        x,y=map(int,input().split())
        temp.append([x,y])
    sinrai.append(temp)

#print(a)
#print(sinrai)
ans=0
for i in range(2**n):
    pat=[]
    kanou=True
    kazu=0
    for j in range(n):
        if((i>>j) & 1):
            pat.append(1)
            kazu+=1
        else:
            pat.append(0)
    #print(pat)
    for j in range(n):      #人
        if(pat[j]==0):
            continue
        for k in range(a[j]):   #発言
            hatu=sinrai[j][k]
            if(pat[hatu[0]-1] != hatu[1]):
                kanou=False
    if(kanou):
        ans=max(ans,kazu)

print(ans)


Measured memory_bytes: 44636
#include<stdio.h>
int main()
{
	long long m=1e9;
	int n,k,s;
	scanf("%d%d%d",&n,&k,&s);
	for(int i=0;i<n;i++)
	{
		if(i<k)
		{
			if(i==0)
			printf("%d",s);
			else 
			printf(" %d",s);
		}
		else 
		{
			if(s==m-1)
			printf(" %d",m);
			else 
			printf(" %d",m-1);
		}		
	}
	printf("\n");
	return 0;
} 

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
ll n,p;
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>p;
	ll b=sqrt(p)+1;
	if (n==1){
		cout<<p<<endl;return 0;
	}
	ll ans=1;
	for (ll i=2;i<=b&&p>=i;++i){
		if (p%i) continue;
		ll cnt=0;
		while(p%i==0) p/=i,cnt++;
		while(cnt>=n) ans*=i,cnt-=n;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
//#include <bits/stdc++.h>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <complex>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

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

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    if(S[2]==S[3]&&S[4]==S[5])cout<<YES<<endl;
	else cout<<NO<<endl;
}

int main(){
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define mp          make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vb          vector<bool>
// #define vc          vector<char>
#define vii         vector<pii>
//#define mi          map<int,int>
//#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
// #define ub(x)       upper_bound(x)
// #define lb(x)       lower_bound(x)
#define endl        '\n'
#define file        freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define fastio      ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
// #define N            1e5+5
#define PRIME           998244353
#define MAX         10001
#define mem0(a)     memset(a,0,sizeof(a))
#define prec        cout<<std::setprecision(9)<<std::fixed
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define pi          3.14159265358979323
int i,j,k;


void Anon_mouS(){
    int n;
    cin>>n;
    vector<vector<int>> a(n+1,vector<int>(3));
    for(int i=1;i<=n;i++){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    vector<vector<int>> dp(n+1,vector<int> (3));
    dp[1][0]=a[1][0];
    dp[1][1]=a[1][1];
    dp[1][2]=a[1][2];
    for(i=2;i<=n;i++){
        dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
    }
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
}

 
int32_t main(){
    fastio;
    int q=1;
    // cin>>q;
    while(q--){
        Anon_mouS();
    }
    return 0;   
}

Measured memory_bytes: 11264