akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <random>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define ALL(v) v.begin(), v.end()

const int NOT_DEFINED = -111;

class Tree {
    int n;
    vector<vector<int>> adjlist;
    vector<vector<int>> inv_adjlist;
    vector<int> depthList;

public:
    Tree(int num);
    int getParent(int id);
    void addNode(int parentId, int childId);
    int getDepth(int id);
    string getType(int id);
    vector<int> getChild(int id);
};

Tree::Tree(int num) {
    n = num;
    REP(i,num) {
        vector<int> v;
        adjlist.push_back(v);
        inv_adjlist.push_back(v);
        depthList.push_back(NOT_DEFINED);
    }
}

void Tree::addNode(int parentId, int childId) {
    adjlist[parentId].push_back(childId);
    inv_adjlist[childId].push_back(parentId);
}

int Tree::getParent(int id) {
    vector<int> parent = inv_adjlist[id];
    if (parent.size()) return parent[0];
    return -1;
}

int Tree::getDepth(int id) {
    //if (depthList[id] != NOT_DEFINED) return depthList[id];
    int depth = 0;
    vector<int> parent = inv_adjlist[id];
    while(parent.size()) {
        if (depthList[parent[0]] != NOT_DEFINED) {
            depth += depthList[parent[0]] + 1;
            break;
        }
        parent = inv_adjlist[parent[0]];
        depth++;
    }
    
    /* slow code
    int parent = id;
    while (1) {
        parent = getParent(parent);
        if (parent != -1) {
            depth++;
        }else {
            break;
        }
    }*/
    depthList[id] = depth;
    return depth;
}

string Tree::getType(int id) {
    if (depthList[id] == 0) {
        return "root";
    }else if (adjlist[id].empty()) {
        return "leaf";
    }else {
        return "internal node";
    }
    return "";
}

vector<int> Tree::getChild(int id) {
    return adjlist[id];
}

int main() {
    int n;
    cin >> n;
    Tree tree = Tree(n);
    REP(i,n) {
        int id, deg;
        cin >> id >> deg;
        int k;
        REP(j,deg) {
            cin >> k;
            tree.addNode(id, k);
        }
    }
    
    REP(i,n) {
        vector<int> children = tree.getChild(i);
        cout << "node " << i << ": parent = ";
        cout << tree.getParent(i) << ", depth = ";
        cout << tree.getDepth(i) << ", ";
        cout << tree.getType(i) << ", [";
        REP(j,children.size()) {
            cout << children[j];
            if (j < children.size()-1) {
                cout << ", ";
            }
        }
        cout << "]" << endl;
    }
    return 0;
}

Measured memory_bytes: 11852
#include <bits/stdc++.h>
using namespace std;
double Khoangcach(pair<int,int> a, pair<int,int> b){
    return sqrtl((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    pair<int,int> a[n];
    for(int i=0; i<n; i++){
        cin >> a[i].first >> a[i].second;
    }
    double res=0;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(i==j) continue;
            res+=Khoangcach(a[i], a[j]);
        }
    }
    cout << fixed << setprecision(16);
    cout << res/(1.0*n);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] lines = line.split(" ", 0);
    	int numSeason = Integer.parseInt(lines[0]);
    	int period = Integer.parseInt(lines[1]);
    	
		line = sc.nextLine();
		lines = line.split(" ", 0);
		int[] testResultList = new int[numSeason];
      	
      	for (int i = 0; i < numSeason; i++) {
      	    testResultList[i] = Integer.parseInt(lines[i]);
      	}
      	
      	for (int i = 0; i < numSeason - period; i++) {
      	    if (testResultList[i] < testResultList[i + period]) {
      	        System.out.println("Yes");
      	    } else {
      	        System.out.println("No");
      	    }
      	}
	}
}


Measured memory_bytes: 84188
#include <cstdio>
using namespace std;
char s[10];

int main()
{
    scanf("%s", s);
    for (int i = 0; s[i]; i++)
    {
        if (s[i] == '7')
        {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

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

using namespace std;

#define fstinpt     ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll          long long
#define sn          1010
#define bn          10000007
#define M           1000000007
#define cin(i)      cin>>i
#define cout(i)      cout<<i
#define sss         cout<<" "
#define nnn         cout<<"\n"

ll sa[bn],sb[bn];


int main()
{
        fstinpt;
        ll a,b,k,ma,mb;
        bool o1 = 1, o2 = 1;
        cin(a>>b>>k);
        for(ll i = 1; i <= a; i++) { cin(sa[i]); sa[i] += sa[i-1]; if(sa[i] > k and o1) { o1 = 0; ma = i-1;}}//cumulative sum A array er
        for(ll i = 1; i <= b; i++) { cin(sb[i]); sb[i] += sb[i-1]; if(sb[i] > k and o2) { o2 = 0; mb = i-1;}}//cumulative sum B array er
        if(sa[a] <= k and sb[b] <= k and sa[a]+sb[b] <= k) { cout(a+b); return 0;}
        if(sa[a] <= k and sb[b] <= k and sa[a]+sb[b] > k) { ma = a; mb = b;}
        if(o1) ma = a; if(o2) mb = b;
        ll jj = ma;
        for(ll i = 0; i <= ma; i++)
        {
                for(ll j = jj-ma+i+1; sa[ma-i]+sb[j] <= k and j <= mb; j++)
                {
                        jj = ma-i+j;
//                        cout(sa[ma-i]+sb[j]<<" "<<jj<<" "<<sa[ma-i]<<"+"<<sb[j]<<" "<<ma-i<<"+"<<j);nnn;
                }
        }
        cout(jj);
        return 0;
}



Measured memory_bytes: 6724
n, m = map(int,input().split())
p = []
s = []
for _ in range(m):
    temp = input().split()
    p.append(int(temp[0]))
    s.append(temp[1])

ac = 0
pena = [0]*n
flag = [False]*n

for pe, se in zip(p, s):
    if se == "AC":
        flag[pe-1] = True
    else:
        if flag[pe-1] is False:
            pena[pe-1] += 1

psum = 0
for i in range(n):
    if flag[i]:
        ac += 1
        psum += pena[i]

print(ac, psum)

Measured memory_bytes: 14916
#include <stdio.h>
int main()
{
    int A,B,arr[3],largest,i;
    scanf("%d%d",&A,&B);
    arr[0] = A+B;
    arr[1] = A-B;
    arr[2] = A*B;
    largest = arr[0];
    for(i=1;i<=2;i++)
    {
        if(arr[i]>=largest)
            largest = arr[i];
    }
    printf("%d\n",largest);
    return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        final int N = Integer.parseInt(sc.next());
        int ans = 0;
        
        for (int i = 1; i <= N; i++) {
            int cnt = 0;
            for (int j = 1; j <= i; j++) {
                if (i % j == 0) cnt++;
            }
            if (i % 2 != 0 && cnt == 8) ans++;
        }

        out.println(ans);
        
        out.flush();
    }
}

Measured memory_bytes: 23636
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>

typedef long long LL;

const int N=305;

int n,k,MOD,f[N][N],s[N][N],c[N][N];

int main()
{
    scanf("%d%d%d",&n,&k,&MOD);
    c[0][0]=1;
    for (int i=1;i<=n;i++)
    {
        c[i][0]=1;
        for (int j=1;j<=i;j++)
            c[i][j]=(c[i-1][j]+c[i-1][j-1])%MOD;
    }
    for (int i=0;i<=k;i++) f[1][i]=1,s[1][i]=k-i+1;
    for (int i=2;i<=n+1;i++)
    {
        for (int j=0;j<=k;j++)
            for (int l=1;l<i;l++)
                (f[i][j]+=(LL)f[i-l][j]*s[l][j+1]%MOD*c[i-2][l-1]%MOD)%=MOD;
        for (int j=k;j>=0;j--) s[i][j]=(s[i][j+1]+f[i][j])%MOD;
    }
    printf("%d",f[n+1][0]);
    return 0;
}

Measured memory_bytes: 4876
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000001

int beki(int a,int b,int M = modulo){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=((long long)x*a)%M;
		}
		a=((long long)a*a)%M;
		b>>=1;
	}
	return x;
}


int gyakugen(int a){
	return beki(a,modulo-2);
}

struct combi{
	deque<int> kaijou;
	deque<int> kaijou_;
	
	combi(int n){
		kaijou.push_back(1);
		for(int i=1;i<=n;i++){
			kaijou.push_back(mod(kaijou[i-1]*i));
		}
		
		int b=gyakugen(kaijou[n]);
		
		kaijou_.push_front(b);
		for(int i=1;i<=n;i++){
			int k=n+1-i;
			kaijou_.push_front(mod(kaijou_[0]*k));
		}
	}
	
	int combination(int n,int r){
		if(r>n)return 0;
		int a = mod(kaijou[n]*kaijou_[r]);
		a=mod(a*kaijou_[n-r]);
		return a;
	}
	
	int junretsu(int a,int b){
		int x = mod(kaijou_[a]*kaijou_[b]);
		x=mod(x*kaijou[a+b]);
		return x;
	}
	
	int catalan(int n){
		return mod(combination(2*n,n)*gyakugen(n+1));
	}
	
};
combi C(1000000);

template <typename T,typename F0,typename F1>
struct rerooting{
	F0 func0;
	F1 func1;
	T init_value;
	
	vector<T> v;
	vector<T> ans;
	
	rerooting(vector<vector<int>> &E,F0 f0,F1 f1,T iv):func0(f0),func1(f1){
		init_value = iv;
		v.resize(E.size());
		ans.resize(E.size());
		dfs(E,0,-1);
		redfs(E,0,-1,init_value);
	}
	
	void dfs(vector<vector<int>> &E,int now,int p){
		v[now] = init_value;
		for(int i=0;i<E[now].size();i++){
			int to = E[now][i];
			if(to==p)continue;
			dfs(E,to,now);
			v[now] = func0(v[now],v[to]);
		}
		v[now] = func1(v[now],now);
	}
	
	void redfs(vector<vector<int>> &E,int now,int p,T pv){
		vector<T> S(E[now].size(),init_value);
		if(S.size()>1){
			for(int i=S.size()-2;i>=0;i--){
				int to = E[now][i+1];
				T x = v[to];
				if(to==p)x = pv;
				S[i] = func0(x,S[i+1]);
			}
		}
		
		T temp = init_value;
		for(int i=0;i<E[now].size();i++){
			int to = E[now][i];
			if(to!=p){
				redfs(E,to,now,func1(func0(temp,S[i]),now));
				temp = func0(temp,v[to]);
			}
			else{
				temp = func0(temp,pv);
			}
		}
		ans[now] = func1(temp,now);
	}
	
};

int main(){
	
	int N;
	cin>>N;
	
	vector<vector<int>> E(N,vector<int>());
	
	for(int i=0;i<N-1;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	
	auto f0 = [](pair<int,int> a,pair<int,int> b){
		return make_pair(mod(mod(a.first * b.first) * C.combination(a.second + b.second,b.second)),b.second+a.second);
	};
	
	auto f1 = [](pair<int,int> a,int ind){
		return make_pair(a.first,a.second+1);
	};
	
	rerooting<pair<int,int>,decltype(f0),decltype(f1)> rr(E,f0,f1,{1,0});
	
	for(int i=0;i<N;i++){
		cout<<rr.ans[i].first<<endl;
	}
	
	return 0;
}

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

int main(){
  int K,A,B;
  cin >> K >> A >> B;
  string x = "NG";
  for(int i=A; i<B+1; i++){
    if(i%K == 0){
      x = "OK";
      break;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 3588
import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Map ((!))
import qualified Data.Map as M
import Data.Maybe
import qualified Data.Set as S
import qualified Data.Tuple as T

addToSet set xs = foldl' (\ acc x -> S.insert (T.swap x) acc) set xs

addToMap m xs = foldl' (\ acc (x, d) -> M.insert x d acc) m xs

dijkstra graph source = dijkstra' graph (S.singleton (0, source)) (M.singleton source 0)

dijkstra' graph pq res
    | S.null pq = res
    | otherwise = dijkstra' graph (addToSet pq' info) (addToMap res info)
    where
      fwd = M.findWithDefault
      ((dis, node), pq') = S.deleteFindMin pq
      nodes = fwd [] node graph
      update = filter (\ (x, e) -> M.notMember x res || dis + e < res!x) nodes
      info = map (\ (x, e) -> (x, dis + e)) update

buildGraph edges =
    let g = groupBy (\ (x, _, _) (y, _, _) -> x == y) edges
    in M.fromList (map (\ x -> (f1 $ head x, map (\ (_, y, z) -> (y, z)) x)) g)

readInt = fst . fromJust . B.readInt
f1 (x, _, _) = x
f3 (_, _, x) = x

main = do
  ((nv,_,r):edges) <- map (\[x,y,z]->(x,y,z)) . map (map readInt . B.words) . B.lines <$> B.getContents
  let g = buildGraph (sort edges)
  let res = dijkstra g r
  mapM_ (putStrLn . maybe "INF" show . flip M.lookup res) [0..nv-1]

Measured memory_bytes: 254828
package main

import (
	"fmt"
)

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	L:
	for i := 1; i <= n; i++ {
		if i % 3 == 0 {
			fmt.Printf(" %d", i)
			continue
		}
		for x := i; x != 0; x /= 10 {
			if x % 10 == 3 {
				fmt.Printf(" %d", i)
				continue L
			}
		}
	}
	fmt.Println()
}



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

int main(){
    int n;
    cin >> n;
    int x[n];
    for(int i = 0; i < n; i++)  cin >> x[i];
    sort(x, x+n);
    cout << (x[n-1]-x[0]+1)/2 << endl;
    return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    cout << (a*b) - (a + b - 1) << endl;
    return 0;
}


Measured memory_bytes: 256
#-*- coding: utf-8 _*_
import datetime

def is_leap(y):
    if y%400==0:   return True
    if y%100==0:   return False
    if y%4==0:     return True
    return False

def get_day(y,m,d):
    if m<=2:
        y-=1
        m+=12
    dy = 365*(y-1)
    c = y/100
    dl=(y>>2)-c+(c>>2)
    dm=(m*979-1033)>>5
    return dy+dl+dm+d-1

def solve(line):
    ipt = map(int, line.split("."))
#     print ipt
    if len(ipt) >3:
        n=0
        for i in range(5):  n+=ipt[i]*mm[i]
        date = datetime.date.fromordinal(offset+n+1)
        print str(date.year)+"."+str(date.month)+"."+str(date.day)
    else:
        n=get_day(*ipt)-offset
#         print n
        n%=1872000
        ret=""
        for i in range(4):
            ret+=str(n/mm[i])+"."
            n%=mm[i]
        ret+=str(n)
        print ret

if __name__=='__main__':
    # const
    mm=(144000,7200,360,20,1)
    w1=(0,0,31,59,90,120,151,181,212,243,273,304,334,365)
    w2=(0,0,31,60,91,121,152,182,213,244,274,305,335,366)
    offset = get_day(2012,12,21)
#     print datetime.MAXYEAR
    
    while True:
        line=raw_input()
        if line=="#":   exit()
        solve(line)

Measured memory_bytes: 4532
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
//#include <intrin.h>
 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define fr(i,a,b) for(int i = a - 1; i >= b; i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define N 300005
#define inf (ll)2e18
#define EPS 1e-12
#define MOD 998244353ll
#define __builtin_popcount(x) __popcnt(x)
 
using namespace std;
 
typedef long long ll;
 
inline void solve()
{
	int r;
	cin >> r;
	cout << fixed << setprecision(10) << 2 * M_PI * r;
}
 
int main()
{
	fast;
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	fore(t, 0, q)
	{
		solve();
		cout << '\n';
	}
}

Measured memory_bytes: 3804
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter};
use std::io::*;
use std::ops::*;
use std::*;

// -----------------------------------------------
// Framework
// -----------------------------------------------

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        {
            let entries = [$(&stringify!([$arg]:), &$arg as &Debug),*];
            stderr().write_fmt(format_args!("{:#?}\n", entries)).unwrap();
        }
    };
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

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

pub fn main() {
    let (A, B) = read!(i32, i32);
    println!("{}", if A <= 8 && B <= 8 { "Yay!" } else { ":(" });
    return;
}


Measured memory_bytes: 4352
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int M, D, M2;
	cin >> M >> D >> M2;

	co(M != M2);


	Would you please return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::endl;
using std::cin;
 
template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
int main() {
	int n; scanf("%d", &n); std::vector<int> a(n);
	for(int i = 0; i < n; i++) scanf("%d", & a[i]);
	sort(begin(a), end(a), std::greater<int>());
	
	i64 ans = 0;
	for(int i = 0; i < n; i++) {
		int k = n - 1;
		for(int j = i + 1; j < n; j++) {
			while(j < k and a[i] >= a[j] + a[k]) k--;
			if(i < j and j < k) ans += k - j;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main(){
  int n;	cin >> n;
  vector<long long>	A(n);
  rep(i,n)	cin >> A[i];
  sort(A.begin(),A.end());
  
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(A[i]==A[j]||A[j]==A[k]||A[k]==A[i])	continue;
        if(A[i]+A[j]>A[k]&&A[i]+A[k]>A[j]&&A[k]+A[j]>A[i])	ans++;
      }
    }
  }
  cout << ans;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
                                        #include<iostream>
                                        #include<cstdio>
                                        #include<vector>
                                        #include<queue>
                                        #include<map>
                                        #include<cstring>
                                        #include<string>
                                        #include <math.h>
                                        #include<algorithm>
                                    //    #include <boost/multiprecision/cpp_int.hpp>
                                        #include<functional>
                                #define int long long
                                        #define inf  1000000007
                                        #define pa pair<int,int>
                                        #define ll long long
                                        #define pal pair<double,pa>
                                        #define ppa pair<int,int>
                                        #define ppap pair<pa,pa>
                                        #define ssa pair<string,int>
                                        #define  mp make_pair
                                        #define  pb push_back
                                        #define EPS (1e-10)
                                        #define equals(a,b) (fabs((a)-(b))<EPS)
                                  #define VI vector<int>
                                        using namespace std;


int gcd(int a,int b){
	if(a<b) return gcd(b,a);
	if(b==0) return a;
	if(a%b==0) return b;
	return gcd(b,a%b);
}
map<int,int>ma;
           signed main(){
               int n,m;
  cin>>n>>m;
         
           	
           	cout<<gcd(n,m)<<endl;
           }
             

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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define LOOP(i, N) for (int i = 1; i <= (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define RLOOP(i, N) for (int i =(int)N; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define pb push_back

typedef long long ll;

typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
//cout<<"Yes"<<endl;
//cout<<"No"<<endl;

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    string s,t;
    cin>>s>>t;
    int sum=0;
    REP(i,s.length()){
        if(s[i]!=t[i]){
            sum++;
        }
    }
    cout<<sum<<endl;
}

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

long long modpow(long long a,long long n,long long p = 1e9+7){
    long long result = 1;
    while(n > 0){
        if(n & 1) (result *= a) %= p;
        (a*=a) %= p;
        n >>= 1;
    }
    return result;
}
#define ll long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define rel(i,x,y) for(ll i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
ll mod = 1e9+7;
ll dp[100010]; //kで割れる個数
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,k; cin >> n >> k;
    ll ans=0;
    rel(i,k+1,1){
        dp[i] = modpow(k/i,n);
        for(ll j=2*i;j<=k;j+=i){
            dp[i] -= dp[j];
            if(dp[i]<0) dp[i] += mod;
        }
        ans = (ans+(dp[i] * i)%mod)%mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4368
#include <iostream>
#include <cstdio>
#include <bitset>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <utility>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>

using namespace std;
using ll=long long;
using vint=vector<int>;
using pint=pair<int,int>;

const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

void solve(){
	char s[4];
	cin >> s;
	int ans = 0;
	rep(i,3){
		if(s[i] == 'o')
			ans++;
	}
	cout << ans * 100 + 700 << endl;
}

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

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

int main(){
  string a;
  bool b=true;
  cin>>a;
  sort(a.begin(),a.end());
  for(int i=0;i<a.size()-1;i++){
    if(a.at(i)==a.at(i+1)){
      cout<<"no"<<endl;
      b=false;
      break;
    }
  }
  if(b)
    cout<<"yes"<<endl;
}


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

typedef long long ll;
typedef long double ld;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


#define rEp(i, a, b) for (int i=a; i<(b); i++)
#define rep(i, a) for (int i=0; i<(a); i++) 
#define ub        upper_bound            // first element >  val(itr)
#define lb        lower_bound            // first element >= val(itr)

#define mp make_pair
#define pb push_back
#define pi 3.141592653589793
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define bitcount(a) __builtin_popcount(a) // count set bits
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007
const int inf = 1e9+9;
const long long INF = 1e18+3;

//to debug 
#define dbg(x) cout << "Line " << __LINE__ << " | " #x ": " << (x) << endl

template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename T> T lcm(T a, T b) { return a * b / gcd(a, b);}
template<typename T> T fast_power(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

ll findMMI_fermat(ll n,ll M) {ll ans= fast_power(n,M-2,M);return ans;}//i.e In (a/b)%M..it calculates MMI of b wrt M
ll add(ll a,ll b,ll mod)  { return (a%mod+b%mod)%mod;       }
ll sub(ll a, ll b,ll mod) { return (a%mod+mod-b%mod)%mod;   }
ll mult(ll a,ll b,ll mod) { return ((a%mod)*(b%mod))%mod;   }

bool isprime(ll a){ if(a==2) {return 1;}if(!(a&1) ) {return 0;}for(ll i=3;i*i<=a;i+=2){if(a%i==0) {return 0;} } return 1;} 





int main() {
    FAST
	int n, p, cnt = 0;
	cin>>n;
	for (int i = 1; i <= n; i++) {
		cin>>p;
		if (p != i)
			cnt++;
	}
	if ((cnt == 0) || (cnt == 2)) cout<<"YES";
	else cout<<"NO";
	return 0;
}


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

using namespace std;

char a[100][100];
int vis[110][110], m, n;
void dfs(int x, int y, char op)
{
    vis[x][y] = 1;
    int di[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
    for(int i = 0;i < 4;i++)
    {
        int tx = x + di[i][0];
        int ty = y + di[i][1];
        if(a[tx][ty] == op && tx < m && tx >= 0 && ty < n && ty >= 0 && !vis[tx][ty])
            dfs(tx, ty, op);
    }
}
int main()
{
     while(scanf("%d %d", &m, &n), m && n)
     {
         memset(vis, 0, sizeof(vis));
         int ans = 0;
         for(int i = 0;i < m;i++)
            scanf("%s", a[i]);
         for(int i = 0;i < m;i++)
            for(int j = 0;j < n;j++)
            {
                if(!vis[i][j])
                {
                    dfs(i, j, a[i][j]);
                    ans++;
                }
            }
        printf("%d\n", ans);
     }
    return 0;
}

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

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

const ll INF = 1LL << 60;

int main(){
  int n;
  cin >> n;
  int a[1000000];
  FOR(i,n){
    cin >> a[i];
  }
  sort(a,a+n);
  int now=a[0];
  int ans=0;
  int v=1;
  FOR(i,n-1){
    if(a[i+1]==now){
      v++;
    }else{
      if(v<now){
        ans+=v;
      }else{
        ans+=v-now;
      }
      now=a[i+1];
      v=1;
    }
  }
  if(v<now){
    ans+=v;
  }else{
    ans+=v-now;
  }
  
  
  cout << ans << endl;
}


Measured memory_bytes: 2560
import sys
input = sys.stdin.readline

A = input().rstrip()
B = input().rstrip()
C = input().rstrip()

def check(P1, P2, P3):
    L1 = len(P1)
    L2 = len(P2)
    L3 = len(P3)
    L = sum([L1, L2, L3])*2+3

    P12 = [True]*L
    for i2 in range(-L2, L1+1):
        for l in range(max(i2, 0), min(i2+L2, L1)):
            if P1[l] != "?" and P2[l-i2] != "?" and P1[l] != P2[l-i2]:
                P12[i2] = False
                break
    
    P13 = [True]*L
    for i3 in range(-L3, L1+1):
        for l in range(max(i3, 0), min(i3+L3, L1)):
            if P1[l] != "?" and P3[l-i3] != "?" and P1[l] != P3[l-i3]:
                P13[i3] = False
                break
    
    P23 = [True]*L
    for i3 in range(-L3, L2+1):
        for l in range(max(i3, 0), min(i3+L3, L2)):
            if P2[l] != "?" and P3[l-i3] != "?" and P2[l] != P3[l-i3]:
                P23[i3] = False
                break

    ans = L1 + L2 + L3
    for i2 in range(-L2, L1+1):
        for i3 in range(-L3, L1+1):
            if P12[i2] and P13[i3] and P23[i3-i2]:
                ans = min(ans, max([L1, L2+i2, L3+i3]) - min([0, i2, i3]))
    return ans



print(min([check(A, B, C), check(B, A, C), check(C, A, B)]))

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

int gcd(int a, int b) 
{ 
    
    if (a == 0) 
       return b; 
    if (b == 0) 
       return a; 
   
    
    if (a == b) 
        return a; 
   
    
    if (a > b) 
        return gcd(a-b, b); 
    return gcd(a, b-a); 
} 
int main()
{
	int k;
	cin>>k;
	long long sum=0;
	for(int i=1;i<=k;i++)
	{
		for(int j=1;j<=k;j++)
		{
			for(int l=1;l<=k;l++)
			{
				sum += gcd(i,gcd(j,l));
			}
		}
	}
	cout<<sum<<endl;
}
  

Measured memory_bytes: 3632
#include <stdio.h>
 
void trans(int year, int month, int day)
{
    if (year < 1868) {
        printf("pre-meiji\n");
    } else if (year == 1868) {
        if (month < 9) {
            printf("pre-meiji\n");
        } else if (month == 9) {
            if (day < 8) {
                printf("pre-meiji\n");
            } else{
                printf("meiji %d %d %d\n", year - 1867, month, day);
            }
        } else{
            printf("meiji %d %d %d\n", year - 1867, month, day);
        }
    } else if (year < 1912) {
        printf("meiji %d %d %d\n", year - 1867, month, day);
    } else if (year == 1912) {
        if (month < 7) {
            printf("meiji %d %d %d\n", year - 1867, month, day);
        } else if (month == 7) {
            if (day < 30) {
                printf("meiji %d %d %d\n", year - 1867, month, day);
            } else{
                printf("taisho %d %d %d\n", year - 1911, month, day);
            }
        } else{
            printf("taisho %d %d %d\n", year - 1911, month, day);
        }
    } else if (year < 1926) {
        printf("taisho %d %d %d\n", year - 1911, month, day);
    } else if (year == 1926) {
        if (month < 12) {
            printf("taisho %d %d %d\n", year - 1911, month, day);
        } else if (month == 12) {
            if (day < 25) {
                printf("taisho %d %d %d\n", year - 1911, month, day);
            } else{
                printf("showa %d %d %d\n", year - 1925, month, day);
            }
        } else{
            printf("showa %d %d %d\n", year - 1925, month, day);
        }
    } else if (year < 1989) {
        printf("showa %d %d %d\n", year - 1925, month, day);
    } else if (year == 1989) {
        if (month == 1) {
            if (day < 8) {
                printf("showa %d %d %d\n", year - 1925, month, day);
            } else{
                printf("heisei %d %d %d\n", year - 1988, month, day);
            }
        }
    } else{
        printf("heisei %d %d %d\n", year - 1988, month, day);
    }
} 
 
int main(void)
{
    int year, month, day;

    while (scanf("%d %d %d", &year, &month, &day) != EOF) {
        trans(year, month, day);
    }
    return 0;
}

Measured memory_bytes: 1036
#include<iostream>
#include<cstdio>
using namespace std;
int n,x,a[200200];
bool vis[200200];
int main()
{
	cin>>n>>x;int m=n+n-1;
	if(x==1||x==n+n-1){puts("No");return 0;}
	a[(m+1)>>1]=x;a[m>>1]=x-1;a[(m>>1)+2]=x+1;
	vis[x]=vis[x-1]=vis[x+1]=true;
	if(m/2>1&&x+2<=m)a[m/2-1]=x+2,vis[x+2]=true;
	if(m/2+3<=m&&x>=3)a[m/2+3]=x-2,vis[x-2]=true;
	for(int i=1,p=1;i<=m;++i)
	{
		if(a[i])continue;
		while(vis[p])++p;
		a[i]=p;vis[p]=true;
	}
	puts("Yes");
	for(int i=1;i<=m;++i)printf("%d\n",a[i]);
	return 0;
}


Measured memory_bytes: 2432
from collections import deque

H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

visited = [[False]*W for _ in range(H)]
ans = 0

for row in range(H):
    for col in range(W):
        if not visited[row][col]:
            visited[row][col] = True
            d = deque([[row, col]])
            if s[row][col] == ".":
                passed_black, passed_white = 0, 1
            else:
                passed_black, passed_white = 1, 0

            while d:
                now_row, now_col = d.popleft()
                visited[now_row][now_col] = True
                for new_row, new_col in [[now_row+1, now_col], [now_row-1, now_col], [now_row, now_col+1], [now_row, now_col-1]]:
                    if 0 <= new_row <= H-1 and 0 <= new_col <= W-1 and s[now_row][now_col] != s[new_row][new_col] and not visited[new_row][new_col]:
                        d.append([new_row, new_col])
                        visited[new_row][new_col] = True
                        if s[new_row][new_col] == ".":
                            passed_white += 1
                        else:
                            passed_black += 1

            ans += passed_black * passed_white

print(ans)

Measured memory_bytes: 56156
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;

#ifndef LOCAL
#define cerr _cer
struct _cert
{
    template <typename T> _cert& operator << (T) { return *this; }
};
_cert _cer;
#endif

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
		cerr << (*i) << " ";
    }
    cerr << "\n";
}

const ll MOD = 1e9 + 7;
const int MX = 210000;
ll fc[MX];
ll bfc[MX];
vector<int> vv;
int was[MX];
vector<int> eds[MX];
vector<int> gr[MX];
int n;
ll x, y;
ll w[MX];
int c[MX];

void dfs1(int v) {
	was[v] = 1;
	vv.push_back(c[v]);
	for (int u: eds[v]) 
		if (!was[u])
			dfs1(u);
}

ll pw(ll a, ll b) {
	ll ans = 1;
	while (b) {
		while (!(b & 1))
			b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	}
	return ans;
}

void init() {
	fc[0] = 1;
	for (int i = 1; i < MX; ++i)
		fc[i] = (fc[i - 1] * i) % MOD;
	for (int i = 0; i < MX; ++i)
		bfc[i] = pw(fc[i], MOD - 2);
}

int main() {
	init();
	scanf("%d%lld%lld", &n, &x, &y);
	for (int i = 0; i < n; ++i) {
		scanf("%d%lld", c + i, w + i);
		gr[c[i]].push_back(i);
	}
	int mn1 = -1;
	int mn2 = -1;
	for (int i = 0; i <= n; ++i) {
		if (gr[i].empty())
			continue;
		int mn = gr[i][0];
		for (int j: gr[i])
			if (w[j] < w[mn])
				mn = j;
		for (int j: gr[i]) {
			if (w[j] + w[mn] <= x) {
				eds[j].push_back(mn);
				eds[mn].push_back(j);
			}
		}
		if (mn1 == -1) {
			mn1 = mn;
		}
		else if (mn2 == -1) {
			mn2 = mn;
		}
		else {
			if (w[mn] < w[mn2])
				mn2 = mn;
			if (w[mn2] < w[mn1])
				swap(mn2, mn1);
		}
	}
	for (int i = 0; i < n; ++i) {
		if (mn1 != -1 && c[mn1] != c[i] && w[mn1] + w[i] <= y) {
			eds[mn1].push_back(i);
			eds[i].push_back(mn1);
		}
		if (mn2 != -1 && c[mn2] != c[i] && w[mn2] + w[i] <= y) {
			eds[mn2].push_back(i);
			eds[i].push_back(mn2);
		}
	}
	ll ans = 1;
	for (int i = 0; i < n; ++i) {
		if (was[i])
			continue;
		vv.clear();
		dfs1(i);
		sort(vv.begin(), vv.end());
		ans = (ans * fc[vv.size()]) % MOD;
		int cnt = 0;
		for (int i = 0; i < vv.size(); ++i) {
			++cnt;
			if (i == vv.size() - 1 || vv[i + 1] != vv[i]) {
				ans = (ans * bfc[cnt]) % MOD;
				cnt = 0;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 31080
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

int main() {
	int n;
	cin >> n;
	int h[N];
	rep(i, n) cin >> h[i];
	int count = 0;
	int ans = 0;
	for(int i = 1; i < n; i++) {
		if(h[i] <= h[i - 1]) {
			count++;
			ans = max(count, ans);
		}
		else {
			count = 0;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    auto A = BigInt(readln().chomp());
    auto B = BigInt(readln().chomp());
    auto c = A.opCmp(B);
    // writeln(c);
    switch (c)
    {
    case -1:
        writeln("LESS");
        break;
    case 0:
        writeln("EQUAL");
        break;
    case 1:
        writeln("GREATER");
        break;
    default:
        assert(0);
    }
}


Measured memory_bytes: 256
n, d = gets.chomp.split.map(&:to_i)
p = [] * n
n.times do
  p << gets.chomp.split.map(&:to_i)
end

ans = 0

0.upto(n - 1) do |i|
  (i + 1).upto(n - 1) do |j|
    dist = 0
    0.upto(d - 1) do |k|
      dist += (p[i][k] - p[j][k])**2
    end
    dist = dist ** 0.5

    if dist == dist.to_i
      ans += 1
    end
  end
end

puts ans

Measured memory_bytes: 1916
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;


int main() {

    int N, A, B;
    cin >> N >> A >> B;

    if ((B - A) % 2 == 0) {
        cout << "Alice" << "\n";
    } else {
        cout << "Borys" << "\n";
    }

    return 0;

}

Measured memory_bytes: 384
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
  	int N, K;
  	cin >> N >> K;

  	ll H[N];
  
  	for(int i=0;i<N;i++){
  		cin >> H[i];
  	}
    sort(H, H+N);


  	if(K>=N){
      cout << 0 <<endl;
      return 0;
    }
  	
    ll ans = 0;
    for(int i=0;i<N-K;i++) ans += H[i];

    cout << ans <<endl;

  	return 0;
}







Measured memory_bytes: 1792
#!/usr/bin/ruby
p Enumerator.new{|y|
	a=[1,1]
	y<<1;y<<1
	(2..(1/0.0)).each{|i|
		a<<a[i-1]+a[i-2]
		y<<a.last
	}
}.take(gets.to_i+1).last

Measured memory_bytes: 6128
S = input()
Scopy = S[::-1]
check = ['maerd', 'remaerd', 'esare', 'resare']
now = 0
while now < len(S):
    if Scopy[now] == 'm':
        if Scopy[now:now+5] != check[0]:
            print('NO')
            break
        else:
            now += 5
    
    elif Scopy[now] == 'e':
        if Scopy[now:now+5] != check[2]:
            print('NO')
            break
        else:
             now += 5
    
    elif Scopy[now] == 'r':
        if Scopy[now:now+7] == check[1]:
            now += 7
        elif Scopy[now:now+6] == check[3]:
            now += 6
        else:
            print('NO')
            break
    else:
        print('NO')
        break

if now == len(S):
    print('YES')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main()
{
	ios::sync_with_stdio(false);
	int n;cin>>n;
	if(n>=400&&n<=599)
		cout<<8<<endl;
	else if(n>=600&&n<=799)
		cout<<7<<endl;
	else if(n>=800&&n<=999)
		cout<<6<<endl;
else if(n>=1000&&n<=1199)
		cout<<5<<endl;
	else if(n>=1200&&n<=1399)
		cout<<4<<endl;
else if(n>=1400&&n<=1599)
		cout<<3<<endl;
	else if(n>=1600&&n<=1799)
		cout<<2<<endl;
else
		cout<<1<<endl;

	return 0;

    
}


Measured memory_bytes: 3648
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		for(int i = 0; i < 3; ++i) {
			String line = in.nextLine();
			System.out.print(line.charAt(i));
		}
		in.close();
		System.out.println("");
	}

}


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

int main ()
{
  char a,b; cin >> a >> b;
  if (a == 'H') {
  	cout << b << endl;
  } else {
    if (b == 'H') cout << 'D' << endl;
    else cout << 'H' << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n, k = 1;
    cin >> n;
    while(k*(k-1)/2 < n) k++;
    if(k*(k-1)/2 > n){
        puts("No");
        return 0;
    }
    vector< vector<int> > s(k, vector<int>());
    int a = 0, b = 1;
    for(int i=1;i<=n;i++){
        s[a].push_back(i);
        s[b].push_back(i);
        b++;
        if(b == k) b = ++a + 1;
    }
    puts("Yes");
    cout << k << endl;
    for(int i=0;i<k;i++){
        cout << k-1;
        for(int j=0;j<k-1;j++){
            cout << " " << s[i][j]; 
        }
        cout << endl;
    }
}


Measured memory_bytes: 2304
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int sum = 0;
        for (int i = 0; i < x.length; i++) {
            x[i] = sc.nextInt();
            sum += x[i];
        }
        int p = sum / n;
        int sum1 = 0;
        int sum2 = 0;
        for (int i = 0; i < x.length; i++) {
            sum1 += Math.pow(p - x[i], 2); 
            sum2 += Math.pow(p + 1 - x[i], 2); 
        }
        System.out.println(Math.min(sum1, sum2));
        sc.close();
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <map>
#include<set>
#include <cmath>
#include <stack>
#include<cstdio>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	cout << a * b << endl ;
}

Measured memory_bytes: 3596
while line = gets
  # ??????????¨?????????° m?????????????¨?????????° f??????????¨?????????° r
  m, f, r = line.split.map(&:to_i)

  break if m == -1 && f == -1 && r == -1

  exam_sum = m + f

  if m == -1 || f == -1
    puts 'F'
  elsif exam_sum >= 80
    puts 'A'
  elsif 65 <= exam_sum && exam_sum < 80
    puts 'B'
  elsif 50 <= exam_sum && exam_sum < 65
    puts 'C'
  elsif 30 <= exam_sum && exam_sum < 50
    if 50 <= r
      puts 'C'
    else
      puts 'D'
    end
  else
    puts 'F'
  end
end

Measured memory_bytes: 8628
#include<bits/stdc++.h>
#define N 500100
using namespace std;
char s[N];
int a[N];
int main(){
	scanf("%s",s);
	int n=strlen(s)+1;
	long long ans=0;
	for(int i=0;i<n;i++){
		if((i<=0||s[i-1]=='>')&&(i>=n-1||s[i]=='<')){
			a[i]=0;
			for(int j=1;i-j>=0&&s[i-j]=='>';j++){
				a[i-j]=max(a[i-j],j);
			}
			for(int j=1;i+j<n&&s[i+j-1]=='<';j++){
				a[i+j]=max(a[i+j],j);
			}
		}
	}
	for(int i=0;i<n;i++) ans+=a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2688
def longest_match(s)
  cnt = 0
  s1 = 0
  s.split('').each do |c|
    if /[AGCT]/ =~ c
      s1 += 1
    else
      cnt = s1 if s1 > cnt
      s1 = 0
    end
  end
  cnt = s1 if s1 > cnt
  cnt
end

s = readline.chop
puts longest_match(s)

Measured memory_bytes: 1788
import sys
from collections import Counter as cc
from numba import njit
import numpy as np

def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())

# sys.setrecursionlimit(10**4)
n = ii()
a = li()
c = cc(a)
N = sum(c.values())
cache = np.full((N+1, N+1, N+1), -1, dtype=float)
cache[0][0][0] = 0
@njit(cache=True)
def dfs(x, y, z, N, cache):
    if x+y+z==0:
        return 0
    if cache[x][y][z]>=0:
        return cache[x][y][z]
    tmp = 1
    if x > 0:
        tmp += dfs(x-1, y, z,N, cache)*x/N
    if y > 0:
        tmp += dfs(x+1, y-1, z, N, cache)*y/N
    if z > 0:
        tmp += dfs(x, y+1, z-1, N, cache)*z/N
    tmp *= N/(x+y+z)
    cache[x][y][z] = tmp
    return tmp

dfs(c[1], c[2], c[3], N, cache)
print(cache[c[1]][c[2]][c[3]])
  

Measured memory_bytes: 324432
#include <bits/stdc++.h>
using namespace std;
#define intMax 2147483647
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repp(i, a, b) for (int i = a; i >= b; i--)
#define be(a) (a.begin(), a.end())
#define rbe(p) (p.rbegin(), p.rend())
#define pb push_back

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, m;
    cin >> n >> m;
    int ans = ceil((double)n / (2 * m + 1));
    cout << ans;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] S = sc.next().toCharArray();
		char[] T = sc.next().toCharArray();
		int c, max= 0;
		for(int i = 0; i < S.length - T.length + 1; i++) {
			c = 0;
			for(int j = 0; j < T.length; j++)
				if(S[i+j] == T[j])
					c++;
			max = Math.max(max, c);
		}
		System.out.println(T.length - max);
	}

}


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

int main() {
  int N, X, T;
  cin >> N >> X >> T;
  if (N % X == 0)
  {
    cout << N / X * T << endl;
  }
  else
  {
    cout << (N / X + 1) * T << endl;
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h> 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<x<<endl
#define all(v) v.begin(), v.end()
using namespace std;
//型エイリアス
using vi = vector<int>;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
const ll inf = 1e18;
const int N = 2e5 + 10;


int main(){
    int x,y;
    cin >> x >> y;

    bool can = false;
    for(int i=0; i<=x; ++i){
        for(int j=0; j<=x-i; ++j){
            if(i+j==x && 2*i+4*j == y){
                can = true;
                break;
            }
        }
        if(can) break;
    }
    if(can) cout("Yes");
    else cout("No");
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  set<int> s;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (s.count(a)) {
      s.erase(a);
    } else {
      s.insert(a);
    }
  }

  cout << s.size() << endl;
}

Measured memory_bytes: 4864
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	string s;
	int K, len;

	cin >> s >> K;
	len = s.length();

	rep(i, len) {
		if (i != len - 1 && s[i] != 'a' && 'z' - s[i] + 1 <= K) {
			K -= 'z' - s[i] + 1;
			s[i] = 'a';
		}
		else if (i != len - 1) continue;
		else {
			K %= 26;
			rep(loop, K) {
				if (s[i] == 'z') s[i] = 'a';
				else s[i]++;
			}
		}
	}

	cout << s << endl;

	return 0;
}


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

int main() {
  int A,B;
  cin >>A>>B;
  int sum = 0;
  
  rep(i, 2){
  if (A >= B){
    sum += A;
    A--;
  }
  else {
    sum += B;
    B--;
  }
  }
  
  cout << sum << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
def solve(string):
    h, w, *s = string.split()
    h = int(h)
    w = int(w)
    for i in range(h):
        for j in range(w):
            if s[i][j] == ".":
                continue
            check = False
            if i == 0 == h - 1:
                pass
            elif i == 0:
                check |= s[i][j] == s[i + 1][j]
            elif i == h - 1:
                check |= s[i][j] == s[i - 1][j]
            else:
                check |= s[i][j] == s[i + 1][j] or s[i][j] == s[i - 1][j]
            if j == 0 == w - 1:
                pass
            elif j == 0:
                check |= s[i][j] == s[i][j + 1]
            elif j == w - 1:
                check |= s[i][j] == s[i][j - 1]
            else:
                check |= s[i][j] == s[i][j + 1] or s[i][j] == s[i][j - 1]
            if not check:
                return "No"
    return "Yes"


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve('{} {}\n'.format(n, m) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 38896