akhauriyash/Code-Regression huggingface dataset:
import math

x = input()
n = int(x)

x = input()
x = x.split()

r = 0
hugo = 1
for i in range(0,len(x)):
  r += int(x[i])*hugo
  hugo *= -1

print(r, end=" ")

for i in range(1,n):
  r2 = (int(x[i-1]) - r/2)*2
  print(int(r2) ,end="")
  r = r2
  if i < n-1:
    print(" " ,end="")
    

Measured memory_bytes: 11464
#include<stdio.h>

#define MAX 200000

int main(){
  int i,j,l,max,min,a[MAX];
  

  scanf("%d",&l);

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

  max = a[1] - a[0];
  min = a[0];
  
  for(i = 1; i < l; i++){
	max = (max < (a[i] - min)) ? (a[i] - min) : max;
	min = (min > a[i]) ? a[i] : min;
  }
  printf("%d\n",max);

  return 0;
}




Measured memory_bytes: 2528
import collections


def main():
    N = int(input())
    a = [0] * (N * 3)
    i = 0
    for ele in input().split():
        ele = int(ele)
        a[i] = ele-1
        i += 1
        a[i] = ele
        i += 1
        a[i] = ele+1
        i += 1

    ctr = collections.Counter(a)
    print(max(list(ctr.values())))


if __name__ == "__main__":
    main()


Measured memory_bytes: 27092
#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;
	}
	else{
		cout<<((n/x)+1)*t;
	}
	return 0;
}

Measured memory_bytes: 3628
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
constexpr long long int INF = 1001001001001001LL;
constexpr long long int MOD = 1000000007LL;
constexpr double PI = 3.1415926535897932;
constexpr long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
constexpr long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = 1; i <= (n); i++)
#define DREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define SREP(i,s,t) for(int i = s; i < t; i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/
int main(){
  int n; cin >> n;
  vector<int> a(n);
  string out = "";

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

  for(int i = 0; i < n; i++) out += to_string(a[i]) + " ";
  cout << out << endl;
  return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;




int main()
{
	int n;
	cin >> n;
	vector<string> S(n);
	rep(i,n)cin >> S[i];
	vector<vector<int>> alph(n,vector<int>(26));
	rep(i,n)
	{
		rep(j,S[i].size())
		{
			alph[i][S[i][j]-'a']++;
		}
	}

	rep(i,n-1)
	{
		rep(j,26)
		{
			alph[i+1][j] = min(alph[i+1][j],alph[i][j]);
		}
	}

	rep(i,26)
	{
		rep(j,alph[n-1][i])
		{
			cout<<(char)('a'+i);
		}
	}
	cout<<endl;


	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int N,Y;
    scanf("%d %d",&N,&Y);
    for(int i=0;i<=N && 10000*i<=Y;i++){
            for(int j=0;i+j<=N && 10000*i+5000*j<=Y;j++){
                if(i*10000+j*5000+(N-i-j)*1000 == Y){
                    printf("%d %d %d",i,j,N-i-j);
                    goto OUT;
                }
          }
    }
printf("-1 -1 -1");
OUT:
return 0;        
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);

int main(){
	ll n,m;
	cin>>n>>m;
	ll a[m];
	fo(i,m) cin>>a[i];
	ll suum=0;
	fo(i,m) suum+=a[i];
	if(suum<n){
		cout<<(n-suum)<<endl;
	}
	else{

		if(suum==n) cout<<0<<endl;
		else cout<<-1<<endl;
	}
	

}

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

int main() {
	int a, b, c;

	cin >> a >> b >> c;

	if (a > b) { swap(a, b); }
	if (a > c) { swap(a, c); }
	if (b > c) { swap (b, c); }

	cout << a << " " << b << " " << c << endl;

	return 0;
}


Measured memory_bytes: 3080
fun main(args: Array<String>) = ABC167B.main()

object ABC167B {
    fun log(message: Any?) {
        println(message)// TODO: ←消す
    }

    fun main() {
        val (A, B, C, K) = readInts()

        var remain = K
        var ans = 0

        val takeA = listOf(A,remain).min()!!
        ans += takeA
        remain -= takeA

        val takeB = listOf(B, remain).min()!!
        remain -= takeB

        val takeC = listOf(remain).min()!!
        ans -= takeC

        println(ans)
    }


    /*####################################################################################*/

    fun readString() = readLine()!!
    fun readStrings() = readLine()!!.split(" ")
    fun readInt() = readLine()!!.toInt()
    fun readInts() = readLine()!!.split(" ").map { it.toInt() }
    fun readLong() = readLine()!!.toLong()
    fun readLongs() = readLine()!!.split(" ").map { it.toLong() }
    fun readMatrixRows(height: Int) = (1..height).map { readLine()!!.toList() }

    fun Boolean.yesOrNo() = if (this) "Yes" else "No"
    fun Double.toNaturalExpr() = println("%f".format(this))
}

Measured memory_bytes: 38892
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int x[200000];
map<int,vector<int>> m;
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
signed main(){
	int a,b,ans=0;
	cin>>a>>b;
	m[0].push_back(-1);
	f(i,a){
		cin>>x[i];
		x[i]--;
		if(i)x[i]=(x[i]+x[i-1])%b;
		else x[i]%=b;
		m[x[i]].push_back(i);
	}
	for(pair<int,vector<int>> p:m){
		int j=1;
		f(i,p.S.size()){
			for(;j<p.S.size()&&p.S[j]-p.S[i]<b;j++){}
			ans+=j-i-1;
		}	
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 23680
<?php
//2倍する操作をk回やる
//if b > a and c > b then "yes" else no

//stud input
while($line = fgets(STDIN)){
    $array[] = $line;
}

//array[0] = "a b c";
//array[1] = "k";
$abc = explode(" ", $array[0]);
$a = $abc[0];
$b = $abc[1];
$c = $abc[2];
$K = $array[1];

for($i = 0; $i < $K; ++$i){
    if($a >= $b){
        $b = $b*2;
    }elseif($b >= $c){
        $c = $c*2;
    }else{
        break;
    }
}

if($a < $b and $b < $c){
    echo "Yes";
}else{
    echo "No";
}
?>


Measured memory_bytes: 16268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<int, ll> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

int n, a, b, lst, cur;
ll ans;
/********** Good Luck :) **********/
int main () {
    TIME(main);
    IOS();

    cin >> n >> a >> b;
    cin >> lst;
    REP (i, n-1) {
        cin >> cur;
        ans += min(ll(b), ll(a)*(cur - lst));
        lst = cur;
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int arr[20001];
int main() {

    int n, m, i;
    for (; ;) {
        i = 1;
        std::scanf("%d %d", &n, &m);
        if (n == 0 && m == 0) break;
        arr[0] = 0;
        for (; i <= n; i++) std::scanf("%d", &arr[i]);
        for (i = n+1; i <= n+m; i++) std::scanf("%d", &arr[i]);
        sort(arr, arr+n+m+1);
        int maxlen = 0;
        for (int i = 1; i <= n+m; i++) maxlen = max(maxlen, arr[i] - arr[i-1]);
        printf("%d\n", maxlen);
    }
    return 0;
}



Measured memory_bytes: 3340
n=int(input())
a=list(map(int,input().split()))
b=[0]
b.extend(a)
b.append(0)
a=b
base=0
for i in range(n+1):
    base+=abs(a[i+1]-a[i])
ans=[]
for i in range(1,n+1):
    ans.append(base+abs(a[i+1]-a[i-1])-abs(a[i+1]-a[i])-abs(a[i]-a[i-1]))
for i in range(n):
    print(ans[i])

Measured memory_bytes: 14048
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (long long i = 0; i < (long long) (n); i++)
using ll=int64_t;
using vi = vector<int>;
using vll = vector<ll>;
/*
    vi v(N);
    for(int i=0;i<N;i++){
        cin>>v.at(i);
    }
*/
/*
int a,b,c,d;
cin>>a>>b>>c>>d;
*/


int main(){

int a,b,c,d;
cin>>a>>b>>c>>d;
if(d<=a)cout<<d;
else if(a<d&&d<(a+b))cout<< a;
else if((a+b)<=d)cout<<b+2*a-d;


}


Measured memory_bytes: 3624
import math


a, b, h, m = map(int, input().split())

jikan = h * 30 + m * 0.5
hun = m * 6

kakudo = min(abs(jikan - hun), 360 - abs(jikan - hun))

print((a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(kakudo))) ** 0.5)

Measured memory_bytes: 9504
import sys

def main():
    data_a = list(input())
    data_b = list(input())
    data_c = list(input())

    now_turn = 'a'

    while 1:
        # print(data_a, data_b, data_c)
        if now_turn == 'a':
            if len(data_a) == 0:
                print('A')
                sys.exit()
            now_turn = data_a[0]
            data_a.pop(0)

        elif now_turn == 'b':
            if len(data_b) == 0:
                print('B')
                sys.exit()
            now_turn = data_b[0]
            data_b.pop(0)

        elif now_turn == 'c':
            if len(data_c) == 0:
                print('C')
                sys.exit()
            now_turn = data_c[0]
            data_c.pop(0)


if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - Remainder Minimization 2019
            var line = ReadLine();
            var L = line[0];
            var R = line[1];
            
            var remainders = new List<long>();
            int count = 0;

            for (long i = L; i <= R; i++)
            {
                var remainder = i % 2019;
                remainders.Add(remainder);
                count++;

                if (count == 2019)
                {
                    break;
                }
            }

            var lib = new Library.Combination();
            var combis = lib.AllCombinations<long>(remainders, 2);
            long min = long.MaxValue;

            foreach(var c in combis)
            {
                long m = c[0] * c[1];
                min = Math.Min(min, m % 2019);
            }

            Console.WriteLine(min);
        }

        static List<long> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => long.Parse(x)).ToList();
        }
    }
}

namespace Library
{
    class Combination
    {
        public IEnumerable<List<T>> AllCombinations<T>(List<T> source, int n,
                                                       bool isAllowDupication = false)
        {
            //[summary]異なる要素から、n個を選ぶ組み合わせを列挙する
            //"isAllowDupication"を"true"にすると、重複を許可する
            //(重複を許可して、nを要素数と同じにすると、順列を列挙する)

            if (n == 1)
            {
                foreach (var s in source)
                {
                    yield return new List<T> { s };
                }

                yield break;
            }
            else
            {
                for (int i = 0; i < source.Count; i++)
                {
                    List<T> clone;

                    if (isAllowDupication)
                    {
                        //重複を許可する場合は、その要素のみを削除
                        clone = new List<T>(source);
                        clone.RemoveAt(i);
                    }
                    else
                    {
                        //重複を許可しない場合は、自分よりも前の要素はすべて削除
                        clone = new List<T>(source.Skip(i + 1));
                    }

                    //再帰処理
                    var items = AllCombinations(clone, n - 1, isAllowDupication);

                    foreach (var item in items)
                    {
                        item.Insert(0, source[i]);
                        yield return item;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 38508
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;
type I = usize;

fn main() {
    input!{
      n: usize,
      k: usize,
      s: chars,
    }

    let mut r = 0;
    let mut cnt = 0;
    while r<n {
        if r > 0 && s[r] == '1' && s[r-1] == '0' {
            cnt += 1;
            while r < n-1 && s[r] == '1' && s[r+1] == '1' {
                r += 1;
            }
            if cnt >= k {
                break;
            }
        }
        r += 1;
    }
    if r >= n {
        r = n-1;
    }
    let mut ans = r+1;
    for l in 1..n {
        if s[l-1] == '0' && s[l] == '1' {
            r += 1;
            while r < n-1 && (s[r] == '0' || (s[r] == '1' && s[r+1] == '1')) {
                r += 1;
            }
            ans = max(ans, (r-l)+1);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <deque> 

using namespace std;


struct Node
{
	int parent;
	int toParentOdd;
//	std::vector<int> children;
	
	std::vector<int> connects;	//链接的对象，包括父节点和子结点 
	std::vector<int> connectEdges;
	int color;	//0--white, 1--black;
};

int n;
Node nodes[100010];

bool isOdd[100010];	//某条边是否是奇数，注意这个值和nodes的编号是不同的，和connectEdges那个值是相同的 
bool isVisited[100010];

int main()
{
	scanf("%d", &n);
	int u, v, w;
	for (int i = 0 ; i < n - 1 ; i++)
	{
		scanf("%d%d%d", &u, &v, &w);
		nodes[u].connects.push_back(v);
		nodes[u].connectEdges.push_back(i);
		
		nodes[v].connects.push_back(u);
		nodes[v].connectEdges.push_back(i);
		
		if (w % 2 == 0)
			isOdd[i] = false;
		else
			isOdd[i] = true;
	}
	
	std::queue<int> q;
	q.push(1);
	nodes[1].color = 0;
	nodes[1].parent = -1;
	isVisited[1] = true;
	
	int curP;
	while (!q.empty())
	{
		curP = q.front();
		q.pop();
		
		for (int i = 0 ; i < nodes[curP].connects.size() ; i++)
		{
			int nextP = nodes[curP].connects[i];
			if (isVisited[nextP])
				continue;
			
			isVisited[nextP] = true;
			int nextEdge = nodes[curP].connectEdges[i];
			nodes[nextP].parent = curP;
			
			if (isOdd[nextEdge])
			{
				nodes[nextP].toParentOdd = true;
				nodes[nextP].color = (1 - nodes[curP].color);	//取反 
			}
			else
			{
				nodes[nextP].toParentOdd = false;
				nodes[nextP].color = nodes[curP].color;
			}
			
			q.push(nextP);
		}
	}
	
	for (int i = 1 ; i <= n ; i++)
		printf("%d\n", nodes[i].color);
	
	
	return 0;
}



Measured memory_bytes: 13184
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int main() {
	int n;
	cin >> n;
	vector<string>anaglam(n);
	map<string, ll>mp;
	for (int i = 0; i < n; i++) {
		cin >> anaglam[i];
		sort(anaglam[i].begin(), anaglam[i].end());
		mp[anaglam[i]]++;
	}
	ll sum = 0;
	for (auto id : mp) {
		sum += (id.second * (id.second - 1)) / 2;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 18176
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]

res = 0
for p in a:
  if sum(i*j for i,j in zip(p,b)) + c > 0:
    res += 1
print(res)

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

int selectionSort(int A[],int N);

int main(){
    int N,ans;
    cin>>N;
    int A[N];

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

    }

    ans=selectionSort(A,N);

    for(int i=0;i<N-1;i++){
        cout<<A[i]<<" ";
    }
    cout<<A[N-1]<<endl;
    cout<<ans<<endl;
    
    return 0;
}

int selectionSort(int A[],int N){
    int minv;
    int ind,sw=0;
    for(int j=0;j<N-1;j++){
        minv=A[j];
        ind=j;
        for(int i=j+1;i<N;i++){

            if(A[i]<minv){
                minv=A[i];
                ind=i;
            }
        }
        if(ind!=j){
            swap(A[j],A[ind]);
            sw++;
        }
    }
    return sw;
}


Measured memory_bytes: 3088
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
def power_func(a,b,p):
  if b==0:
    return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return (d*d)%p
  else:
    return (a*power_func(a,b-1,p))%p
n,k=map(int,input().split())
mod=10**9+7
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
ans=0
r=min(k,n)
for i in range(r+1):
  ans=(ans+cmb(n,i,mod)*cmb(n-1,i,mod))%mod
print(ans)

Measured memory_bytes: 81008
// A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;
int main()
{
    int n;

    cin >> n;
    
    vector<string>W(n);
    map<string,int> m;
    for(int i = 0;i < n; i++) {

        cin >> W[i];
    }
    m[W[0]] = 1;
    for (int i = 1; i < n; i++) {
        if (W[i - 1][W[i - 1].size() - 1] != W[i][0]) {
            cout << "No" << endl;
            return 0;
        }
        else if (m.count(W[i]) != 0) {
            cout << "No" << endl;
            return 0;
        }

        m[W[i]] = 1;


    }
    cout << "Yes" << endl;

    return 0;
}



Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
 
 
int main(void){
  string S, T, U;
  cin >> S >> T;
  int A, B;
  cin >> A >> B;
  cin >> U;
  if(U == S){
    cout << A - 1 << " " << B;
  }
  else{
    cout<< A << " " << B - 1;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    
    
    int a,b,c,d,e,x,y,z,h,j,k;
    
    cin>>a>>b>>c>>d>>e;
    
    
    
    x=abs(a);
    y=x*c;
    
    h=b-a;
    j=h*e;
    z=b*e;
    
    if(a<0){
        k=y+d+z;
        cout<<k<<endl;
    }
        else if(a>0){
        cout<<j<<endl;
    }
    return 0;
}


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

int main()
{

int a,b;

cin>>a>>b;

	if(a > b)cout<<"a > b"<<endl;        //真の場合
		else
		if(a < b)cout<<"a < b"<<endl;    //真の場合
			else
			cout<<"a == b"<<endl;       //偽の場合

return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int N;
    cin >> N;
    vector<int> A(N+1);
    A[N] = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<int> B(13,0);
    for (int i = 0; i < N; i++) {
        B[A[i]]++;
    }
    if(B[0] > 0){
        printf("0\n");
        return 0;
    }
    if(B[12] > 1){
        printf("0\n");
        return 0;
    }
    for (int i = 1; i < 12; i++) {
        if(B[i] > 2){
            printf("0\n");
            return 0;
        }   
    }

    vector<bool> ans(24, false);
    ans[0] = true;
    sort(ALL(A));
    A.erase(unique(ALL(A)), A.end());
    int L = A.size();
    // for (int i = 0; i < L; i++) {
    //     printf("%d\n", A[i]);
    // }
    for (int i = 1; i < L; i++) {
        if(B[A[i]] == 2){
            ans[A[i]] = true;
            ans[24-A[i]] = true;
        }
        else{
            if(ans[A[i-1]] == true){
                ans[24-A[i]] = true;
            }
            else{
                ans[A[i]] = true;
            }
        }
    }
    if(B[12] == 1){
        ans[12] = true;
    }

    int kotae = 24;
    int tmp = 0;
    for (int i = 1; i < 24; i++) {
        if(ans[i]){
            kotae = min(kotae, i - tmp);
            tmp = i;
        }
    }
    kotae = min(kotae, 24 - tmp);

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

}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);


int main() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    if (K < A) {
        cout << K << endl;
    } else if (K <= A+B) {
        cout << A << endl;
    } else {
        K -= (A+B);
        cout << A - K << endl;
    }
    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define ll long long
#define re register
using namespace std;
const int maxn=1e5+10;
template<typename T> void read(T &x){
	T f=1;x=0;
	char c=getchar();
	while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	x*=f;
}
int n;
int h[maxn];
int f[maxn];
int main(){
	read(n);
	h[0]=999999999;
	for(re int i=1;i<=n;i++){
		read(h[i]);
	}
	for(int i=2;i<=n;i++){
		f[i]=min(f[i-1]+abs(h[i]-h[i-1]),f[i-2]+abs(h[i]-h[i-2]));
	}
	cout<<f[n]<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define endl '\n'
using namespace std;
const int N = 2e5 + 5;
const int INF = 1e9;

int n, X, Y;
vector <int> red_nb[N], blue_nb[N];

int low[N], high[N], timer;
int depth[N], par[N];
void DFS_blue(int v)
{
    low[v] = high[v] = ++timer;
    for(int u: blue_nb[v])
    {
        if(u != par[v])
        {
            depth[u] = depth[v] + 1;
            par[u] = v;
            DFS_blue(u);
            high[v] = max(high[v], high[u]);
        }
    }
}

bool in_subtree(int u, int v)
{
    if(u == 0)
        return false;
    return (low[u] <= low[v] && high[u] >= low[v]);
}

bool far_blue(int u, int v)
{
    if(depth[u] > depth[v])
        swap(u, v);
    if(u == v || u == par[v] || u == par[par[v]])
        return false;
    if(depth[v] <= depth[u] + 2)
        if(in_subtree(u, v))
            return false;
    if(depth[v] <= depth[u])
        if(in_subtree(par[u], v))
            return false;

    return true;
}

bool special[N];
int ans = 2, red_dist[N];
void DFS_red(int v, int parent = -1)
{
    if(red_dist[v] > depth[v])
        return;
    ans = max(ans, depth[v] * 2);

    if(red_dist[v] == depth[v])
        return;
    if(special[v])
        ans = INF;

    for(int u: red_nb[v])
    {
            if(u != parent)
            {
                red_dist[u] = red_dist[v] + 1;
                DFS_red(u, v);
            }
    }

}

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

    int u, v;

    cin >> n >> X >> Y;
    for(int i = 1; i < n; i++)
    {
        cin >> u >> v;
        red_nb[u].pb(v);
        red_nb[v].pb(u);
    }

    for(int i = 1; i < n; i++)
    {
        cin >> u >> v;
        blue_nb[u].pb(v);
        blue_nb[v].pb(u);
    }

    DFS_blue(Y);

    for(int i = 1; i <= n; i++)
        for(int u: red_nb[i])
            if(far_blue(u, i))
                special[u] = special[i] = true;

    DFS_red(X);


    if(ans == INF)
        cout << -1 << endl;
    else
        cout << ans << endl;

    return 0;
}


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

vector<int> V[200100];//各頂点についてつながる辺を記録。りんせつリスト
ll P[200100];//根に与えられたｘの値の和
int visited[200100];
//上の根から順にXをたしていく関数
int sumne(int w){
	for(int k : V[w]){
      	
      	int gg=visited[k]; 
    	if(gg != -1){continue;}
    	else{
          	
        	visited[k]=1;//来たことを記録
        	P[k]+=P[w];
        	sumne(k);
        }
    }
}

int main() {
	int N,Q;
  	cin >>N>>Q;
  	for(int i=1;i<=N-1;i++){
    	int a,b;
      	cin >>a>>b;
      	V[a].push_back(b);
      	V[b].push_back(a);
    }
  	for(int i=1;i<=N;i++){
    	visited[i]=-1;
      	P[i]=0;
    }
  	for(int i=1;i<=Q;i++){
  		int p,x;
  		cin >>p>>x;
  		P[p]+=x;
    }
  	visited[1]=1;
  	sumne(1);
  	for(int i=1;i<=N;i++){
    	cout<<P[i]<<" ";
    }
  
}


Measured memory_bytes: 21888
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
unsigned long long x;
unsigned long long n;
int ans;
int main(){
	cin>>x;
	n=100;
	while(n<x)
	{
		n+=(n/100);
		ans++;
	}
	cout<<ans;
	return 0;
}

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

long long a[55];
long long b[55];
long long c[55];
long long d[55];

long long abso(long long x)
{
	if(x<0)
		return -1*x;

	else
		return x;
}

long long dist(long long a,long long b,long long c,long long d)
{
    return (abso(a-c)+abso(b-d));

}

int main() {

    long long n,m,di,g=1,h;
    scanf("%lld %lld",&n,&m);

    for(long long i=1;i<=n;i++)
    {
        scanf("%lld %lld",&a[i],&b[i]);

    }

    for(long long i=1;i<=m;i++)
    {
        scanf("%lld %lld",&c[i],&d[i]);


    }


    for(long long j=1;j<=n;j++)
    {
        di=dist(a[j],b[j],c[1],d[1]);
        g=1;

        for(long long i=1;i<=m;i++)
        {

            if(dist(a[j],b[j],c[i],d[i])<di)
            {
                di=dist(a[j],b[j],c[i],d[i]);
                g = i;

            }

        }

        printf("%lld\n",g);


    }


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <stack>
#include <functional>
#include <sstream>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007
#define M 998244353

using namespace std;

int main(){
    lli n,sum=0;
    lli i,j,k;
    map<lli,lli> mp;
    cin>>n;
//    if(n==1){
//        cout<<"0"<<endl;
//        exit(0);
//    }
    i=2;
    while((i*i)<=n){
        if(n%i==0){
            n/=i;
//            cout<<i<<"で割って"<<n<<"になる"<<endl;
            mp[i]++;
        }
        else{
            i++;
        }
    }
    if(n>1){
        mp[n]++;
    }
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        i=1;
        while(1){
            if((1+i)*i/2>itr->second){
                sum+=i-1;
                break;
            }
            else{
                i++;
            }
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3656
#include<stdio.h>

int main(){
  long n,i,j,k,flag;
  long cnt=0;
  char s[310][310];
  scanf("%ld",&n);
  for(i=0;i<n;i++)
    scanf("%s",s[i]);
  for(k=0;k<n;k++){
    flag=1;
    for(i=0;i<n-1;i++){
      for(j=i+1;j<n;j++){
        if(s[(i+k)%n][j]!=s[(j+k)%n][i]){
          flag=0;
          break;
        }
      }
      if(!flag) break;
    }
    cnt+=n*flag;
  }
  printf("%ld\n",cnt);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
// Euclidean Algorithm
int gcd(int a, int b){if (a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a * b / gcd(a, b);}

int main(){
  int A, B, C, X; cin >> A >> B >> C >> X;
  int ans = 0;
  rep(i,A+1){
    rep(j,B+1){
      rep(k,C+1){
        if( X == 500*i + 100*j + 50*k) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=0;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_M = 100001;

ll a[100001] = {};
int main() {
	ll n; cin >> n;
	ll ans = 0;
	repe(i, 1, n) {
		ll A; cin >> A;

		if (i >= 2 && a[i - 1] > 0 && A > 0) {
			A--;
			ans++;
		}

		ans += A / 2;
		a[i] = A % 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

ss = input().split('T')
x, y = map(int, input().split())

dpx = dict()
dpy = dict()

dpx[0+len(ss[0])] = True
dpy[0] = True

direct = 1 #0:x, 1:y


for s in ss[1:]:
    if direct%2 == 0:
        tmp = dict()
        n = len(s)
        for k, v in dpx.items():
            tmp[k+n] = True
            tmp[k-n] = True
        direct += 1
        dpx = tmp
    else:
        tmp = dict()
        n = len(s)
        for k, v in dpy.items():
            tmp[k+n] = True
            tmp[k-n] = True
        direct += 1
        dpy = tmp

# print(x, y)
# print(dpx, dpy)
# print(x in dpx)
# print(y in dpy)
if x in dpx and y in dpy:
    print('Yes')
else:
    print('No')


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

int main()
{
  int N, M, X;
  cin >> N >> M >> X;
  vector<int> A(M);
  for (auto &a : A)
  {
    cin >> a;
  }
  int left = 0;
  int right = 0;
  for (auto &a : A)
  {
    if (a < X)
      left++;
    else
      right++;
  }
  cout << min(left, right) << endl;
  return 0;
}


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

int main() {
	int H,W;
    cin >> H >> W;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        string s;
        cin >> s;
        if(s=="snuke"){
          cout << (char)('A'+j) << i+1 << endl;
        }
      }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, C, D, N, H,  ans=0;
    string S;
    cin >> A >> B >> H;

    ans = (A+B)*H/2;
    cout <<ans<<endl;
    
    // if(A<B)
    // 	cout << 0<<endl;
    // else
    // 	cout <<10<<endl;
    

    // string S;
    // cin >>S;
    // cout << S + "pp"<<endl;

    // if(S[0]==S[1] && S[1]==S[2] && S[2]==S[3])
    // 	puts("SAME");
    // else
    // 	puts("DIFFERENT");    
    	
}


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

int main(void) {
  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);
  for (int i = 0; i < A; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < B; i++) {
    cin >> b[i];
  }
  int ans = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());
  for (int i = 0; i < M; i++) {
    int x, y, c;
    cin >> x >> y >> c;
    x--;
    y--;
    ans = min(ans, a[x] + b[y] - c);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1152
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

class Ruiwa():
    def __init__(self, a):
        self.H = h = len(a)
        self.W = w = len(a[0])
        self.R = r = a
        for i in range(h):
            for j in range(1,w):
                r[i][j] += r[i][j-1]

        for i in range(1,h):
            for j in range(w):
                r[i][j] += r[i-1][j]

    def search(self, x1, y1, x2, y2):
        if x1 > x2 or y1 > y2:
            return 0

        r = self.R
        rr = r[y2][x2]
        if x1 > 0 and y1 > 0:
            return rr - r[y1-1][x2] - r[y2][x1-1] + r[y1-1][x1-1]
        if x1 > 0:
            rr -= r[y2][x1-1]
        if y1 > 0:
            rr -= r[y1-1][x2]

        return rr

def main():
    n,m,q = LI()
    lr = [LI_() for _ in range(m)]
    pq = [LI_() for _ in range(q)]

    a = [[0]*n for _ in range(n)]

    for l,r in lr:
        a[l][r] += 1

    rui = Ruiwa(a)
    rr = []
    for p,q in pq:
        rr.append(rui.search(p,p,q,q))

    return '\n'.join(map(str, rr))




print(main())


Measured memory_bytes: 70836
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int h10(int x){
  return (x + 9) / 10 * 10;
}

int rem(int x){
  return h10(x) - x;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  int sum = h10(a) + h10(b) + h10(c) + h10(d) + h10(e);
  sum -= max({rem(a), rem(b), rem(c), rem(d), rem(e)});
  cout << sum << endl;
  return 0;
}


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

int main(){
  string S;
  cin >> S;
  
  if(S == "SAT") cout << '1' << endl;
  if(S == "FRI") cout << '2' << endl;
  if(S == "THU") cout << '3' << endl;
  if(S == "WED") cout << '4' << endl;
  if(S == "TUE") cout << '5' << endl;
  if(S == "MON") cout << '6' << endl;
  if(S == "SUN") cout << '7' << endl;
  
  return 0;
}

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

const int INF = 1001001001;

void solve(long long N, long long X, long long Y){
    vector<int> ans(N);
    rep(sv,N){
        vector<int> dist(N, INF);
        queue<int> q;
        auto push = [&](int v, int d) {
        if (dist[v] != INF) return;
        dist[v] = d;
        q.push(v);
        };
        push(sv, 0);
        while(!q.empty()){
            int v = q.front(); q.pop();
            int d = dist[v];
            if(v-1 >= 0) push(v-1, d+1);
            if(v+1 < N) push(v+1, d+1);
            if(v == X) push(Y, d+1);
            if(v == Y) push(X, d+1);
        }
        rep(i, N) ans[dist[i]]++;
    }
    rep(i,N) ans[i] /= 2;
    for(int i=1; i<=N-1; ++i){
        cout << ans[i] << endl;
    }
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    --X; --Y;
    solve(N, X, Y);
    return 0;
}


Measured memory_bytes: 256
import sys
n = int(input())
A = list(map(int,sys.stdin))
cnt = 0
G = [int((2.25**i-1)/1.25)for i in range(17,0,-1)]
G = [v for v in G if v <= n]
def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
for g in G:
    insertionSort(A, n, g)
print(len(G))
print(*G)
print(cnt)
print('\n'.join(map(str,A)))


Measured memory_bytes: 126048
#include<iostream>
using namespace std;
int main(){
    int a;
    cin >> a;
    int b = a / 15;
    int c = a % 15;
    long long d = 0;
    int i;
    for(i = 0;i < b;i++){
        d += 60 + (120 * i);
    }
    for(int j = 1;j < c+1;j++){
        if(j % 3 == 0 || j % 5 == 0){
        }
        else{
            d += (15 * b) + j;
        }
    }
    cout << d << endl;
}
        

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

int main(){
    int a;
    cin >> a;

    cout << (a+a*a+a*a*a) << endl;
    return 0;
}

Measured memory_bytes: 3640
n, m = map(int, input().split())
list_score = [ list(map(int,input().split(" "))) for i in range(m)]

ans = [0]*n

for x, y in list_score:
    ans[x-1] += 1
    ans[y-1] += 1

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

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


int main() {
    string n;
    string text = "No";
    cin >> n;

    if (n.at(0) == n.at(1) && n.at(1) == n.at(2) ||
        n.at(1) == n.at(2) && n.at(2) == n.at(3)) {
            text = "Yes";
    }

    cout << text << endl;
}

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

int main()
{
    int n, ans = 0, a, b, c, i;
    cin>>n;
    for(a = 1; a <= n; a++)
    {
        for(b = 1; b <= n; b++)
        {
            for(c = 1; c <= n; c++)
            {
                i = __gcd(c, b);
                ans += __gcd(a, i);
            }
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <complex>
#include <cstdio>

using namespace std;

typedef complex<double> P;

//ヤバそう？
#define X real()
#define Y imag()


class Triangle{
public:
	P p1,p2,p3;

	//e1:p2-p3間の辺
	double e1,e2,e3;

	//a1:e1の向かいの角
	double a1,a2,a3;

	//cosine formula
	//長さaの辺の向かいの角の角度
	double cf(double a,double b,double c){
		return acos((b*b+c*c-a*a)/(2.0*b*c));
	}

	Triangle(P _p1,P _p2,P _p3){
		p1=_p1;
		p2=_p2;
		p3=_p3;

		e1=abs(p2-p3);
		e2=abs(p1-p3);
		e3=abs(p1-p2);

		a1=cf(e1,e2,e3);
		a2=cf(e2,e1,e3);
		a3=cf(e3,e1,e2);

	}

	P get_center(){
		return (sin(2*a1)*p1+sin(2*a2)*p2+sin(2*a3)*p3)/(sin(2*a1)+sin(2*a2)+sin(2*a3));
	}

	double get_r(){
		return e1/(2.0*sin(a1));
	}


};

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

	for(int i=0;i<n;i++){
		P p[3];
		for(int j=0;j<3;j++){
			double x,y;
			cin>>x>>y;
			p[j]=P(x,y);
		}
		Triangle T(p[0],p[1],p[2]);

		P xy=T.get_center();
		double r=T.get_r();

		printf("%.3f %.3f %.3f\n",xy.X,xy.Y,r);
	}


	return 0;
}

Measured memory_bytes: 1336
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

const ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
int compare(string a, string b) {
	int i;
	for (i = 0; i < a[i] != '\0'; i++) {
		if (b[i] == '\0')
			return -1;
		else if (a[i] < b[i])
			return 1;
		else if (a[i] > b[i])
			return -1;
	}
	if (b[i] != '\0')
		return 1;
	else
		return 0;
}
int main() {
	int n, i, c[33], p[33],d,t,ans=24,q=-1,l=-1;
	cin >> n;
	for (i = 0; i <= 12; i++)
		c[i] = 0;
	for (i = 0; i < n; i++) {
		cin >> d;
		c[d]++;
	}
	if (c[0] > 0) {
		cout << "0" << endl;
		return 0;
	}
	t = 1;
	for (i = 1; i <= 12; i++) {
		if (c[i] > 2) {
			cout << "0" << endl;
			return 0;
		}
		if (c[i] == 2) {
			p[12 + i] = 1;
			p[12 - i] = 1;
		}
		else if(c[i]==1) {
			p[12 + i * t] = 1;
			p[12 - i * t] = 0;
			t*=-1;
		}
		else {
			p[12 + i] = 0;
			p[12 - i] = 0;
		}
	}
  p[12]=1;
	for (i = 0; i <= 24; i++) {
		if (p[i] == 1) {
			if (q == -1)
				q = i;
			else {
				ans = min(ans, i - q);
				q = i;
			}
			if (l == -1)
				l = i;
		}
	}
	ans = min(ans, 24 + l - q);
	cout << ans << endl;
}

Measured memory_bytes: 4992
///////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
///////////////////////////////////////////////////////////
#define ll long long
#define ull insigned lon long
///////////////////////////////////////////////////////////
int absolute(int n);
void input(vector<int>& vec);
void print(vector<int> vec); void print(vector<double> vec);
int sum(vector<int> vec); double sum(vector<double> vec);
void upsort(vector<int>& vec);
void downsort(vector<int>& vec);
int maxvec(vector<int> vec);
int minvec(vector<int> vec);
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    input(a);
    vector<double>b(n);
    for(int i=0;i<n;++i){
        b.at(i)=1.0/a.at(i);
    }
    cout<<1.0/sum(b)<<endl;
    return 0;
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int absolute(int n)
{
    if (n < 0) {
        return (-n);
    }
    return n;
}

void input(vector<int>& vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cin >> vec.at(i);
    }
}

void print(vector<int> vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cout << vec.at(i) << " ";
    }
    cout << endl;
}

void print(vector<double> vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cout << vec.at(i) << " ";
    }
    cout << endl;
}

int sum(vector<int> vec)
{
    int s = accumulate(vec.begin(), vec.end(), 0);
    return s;
}

double sum(vector<double> vec)
{
    double s = accumulate(vec.begin(), vec.end(), 0.0);
    return s;
}

void upsort(vector<int>& vec)
{
    sort(vec.begin(), vec.end());
}

void downsort(vector<int>& vec)
{
    sort(vec.begin(), vec.end(), greater<int>());
}

int maxvec(vector<int> vec)
{
    int m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = max(m, vec.at(i));
    }
    return m;
}

int minvec(vector<int> vec)
{
    int m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = min(m, vec.at(i));
    }
    return m;
}
///////////////////////////////////////////////////////////

Measured memory_bytes: 384