akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)

	N, R := getInt(), getInt()
	if N >= 10 {
		out(R)
		return
	}
	out(R + 100*(10-N))
}


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


int main() {
    int N,M,O,cnt=0;
    cin >> N >> M >> O;

    for(int i=M;i<=O;i++){
        if (i%N==0){
            cout << "OK" << endl;
            cnt=1;
            break;
        }
    }
    if(cnt==0)cout << "NG" << endl;

    

}




Measured memory_bytes: 3624
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;
  vll dp(n+1, INF);
  dp[0] = 0;

  repLRE(i, 1, n){
    ll del = 1;
    chmin(dp[i], dp[i-del] + 1);
    del = 6;
    while(i - del >= 0){
      chmin(dp[i], dp[i-del] + 1);
      del *= 6;
    }
    del = 9;
    while(i - del >= 0){
      chmin(dp[i], dp[i-del] + 1);
      del *= 9;
    }    
  }

  cout << dp.back() << endl;

  return 0;
}


Measured memory_bytes: 3816
import java.lang.Math.sqrt

fun main(args: Array<String>) {
    val array = IntArray(readLine()?.toInt() ?: 0) {
        readLine()?.toInt() ?: 0
    }
    val primeJudge = PrimeJudge(array.max() ?: 0)
    println(array.filter(primeJudge::isPrime).count())
}

class PrimeJudge(max: Int) {
    private val numArray = BooleanArray(max+1) { true }
    init {
        numArray[0] = false
        numArray[1] = false
        for (i in 2..sqrt(numArray.size.toDouble()).toInt()) {
            if (numArray[i]) {
                for (j in i * 2 until numArray.size step i) {
                    numArray[j] = false
                }
            }
        }
    }
    fun isPrime(num: Int) = numArray[num]
}


Measured memory_bytes: 132612
/*  ex4_2
    yy8332  */

#include <stdio.h>
#include <math.h>


int main(void){
  double lengthA, lengthB, hour, minute, theta, ans;

  //入力読み取り
  scanf("%lf %lf %lf %lf",&lengthA, &lengthB ,&hour ,&minute);

  //角度計算
  theta = (((hour + minute / 60) * 30 - minute * 6) / 180) * M_PI;

  //長さ計算
  ans = pow(lengthA, 2.0) + pow(lengthB, 2.0) - 2 * lengthA * lengthB * cos(theta);

  ans = sqrt(ans);


  //出力
  printf("%.10f",ans);


  return 0;
}


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

int main(){
 
  string s;
  cin >> s;
  
  int counter = 0;
  
  if(s.at(0) == '1') counter++;
  if(s.at(1) == '1') counter++;
  if(s.at(2) == '1') counter++;
  
  cout << counter << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	double w,h,x,y;cin >> w >> h >> x >> y;
	printf("%lf ",w*h/2);
	if(x*2 == w && y*2 == h)cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 3760
/**************************************************************
	File name: B.cpp
	Author: huhao
	Email: 826538400@qq.com
	Create time: 2019/8/24 下午8:06:40
**************************************************************/
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define fr(i,a,b) for(int i=(a),end_##i=(b);i<=end_##i;i++)
#define fd(i,a,b) for(int i=(a),end_##i=(b);i>=end_##i;i--)
int read()
{
	int r=0,t=1,c=getchar();
	while(c<'0'||c>'9')
	{
		t=c=='-'?-1:1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		r=(r<<3)+(r<<1)+(c^48);
		c=getchar();
	}
	return r*t;
}
const int N=2010,mod=1000000007;
long long n,k,a[N],s[N],S[N],ans;
int main()
{
	n=read();
	k=read();
	fr(i,1,n)
	{
		a[i]=read();
		S[a[i]]++;
	}
	fr(i,1,n)
	{
		s[a[i]]++;
		fr(j,a[i]+1,2000)
			ans=(ans+k*s[j]+k*(k-1)/2%mod*S[j])%mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define int long long int
#define N 200005
void fast(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
char c[203][203];
vector<int> g[203];
int lvl[203],vis[203];
void dfs(int u,int p){
    vis[u]=1;
    lvl[u]=1+lvl[p];
    for(auto v:g[u]){
        if(vis[v]==0){dfs(v,u);}
    }
}
main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cin>>c[i][j];
            if(c[i][j]=='1'){
                g[i].pb(j);
            }
        }
    }
    int ans=-1;
    for(int i=1;i<=n;i++){
        memset(vis,0,sizeof(vis));
        memset(lvl,0,sizeof(lvl));
        queue<int> q;
        q.push(i);
        lvl[i]=1;
        while(!q.empty()){
            int x=q.front();
            q.pop();
            if(vis[x]==1)continue;
            vis[x]=1;
            for(auto j:g[x]){
                if(vis[j]==0){
                    lvl[j]=1+lvl[x];
                    q.push(j);
                }
            }
        }
        int mx=0,f=0;
        for(int j=1;j<=n;j++){
            mx=max(mx,lvl[j]);
            for(auto k:g[j]){
                if((lvl[j]==(1+lvl[k]))||(lvl[k]==(1+lvl[j]))){

                }
                else f=1;
            }
        }
        if(f==0)ans=max(mx,ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 916
import java.util.HashMap;
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		HashMap<Integer, Integer> map;
		while(true){
			map = new HashMap<Integer, Integer>();
			int a = in.nextInt();
			int l = in.nextInt();
			if(l==0) break;
			int idx = 0;
			map.put(a, idx);
			a = culcNext(a, l);
			idx++;
			while(!map.containsKey(a)){
				map.put(a, idx);
				a = culcNext(a, l);
				idx++;
			}
			System.out.println(map.get(a)+" "+a+" "+(idx-map.get(a)));
		}
	}
	
	public static int culcNext(int a, int l){
		char[] al = new char[l];// a large
		int[] count = new int[10];
		char[] as = new char[l];// a small
		while(a > 0){
			count[a%10]++;
			a /= 10;
		}
		int idx = 9;
		for(int i=0; i<l; i++){
			while(idx > 0 && count[idx] == 0) idx--;
			al[i] = (char)(idx + '0');
			as[l-1-i] = al[i];
			count[idx]--;
		}
		return Integer.valueOf(String.valueOf(al)) - Integer.valueOf(String.valueOf(as));
	}
}

Measured memory_bytes: 21316
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
//(a3+b3)(a2-b2)+a2b2(a-b)
//(a-b)(a⁴+a³b+a²b²+ab³+b⁴) 
int main(){
  ll X; cin>>X;
  for(int i=-200; i<=200; i++){
    for(int j=-200; j<=200; j++){
      ll A=i-j;
      ll B=i*i*i*i+i*i*i*j+i*i*j*j+i*j*j*j+j*j*j*j;
      if(A*B==X){
        cout<<i<<" "<<j<<endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main(void){
    int t,x;
    cin >> t >> x;
    printf("%.3lf\n",(double)t/x);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text.RegularExpressions;

namespace ConsoleApp23
{
    class Program
    {
        private static string[][] _board;

        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int h = line[0];
            int w = line[1];
            _board = new string[h][];

            for (int i = 0; i < _board.Length; i++)
            {
                _board[i] = Regex.Split(Console.ReadLine(), string.Empty).ToArray();
            }

            for (int i = 0; i < _board.Length; i++)
            {
                for (int j = 0; j < _board[i].Length; j++)
                {
                    if(_board[i][j] == ".")
                    {
                        var count = CountArroundBombPoint(i, j);
                        Console.Write(count.ToString());
                    }
                    else
                    {
                        Console.Write(_board[i][j]);
                    }
                }

                if (i != h - 1)
                {
                    Console.WriteLine("");
                }
            }

        }

        static int CountArroundBombPoint(int rowPoint, int colPoint)
        {
            int result = 0;
            for (int i = rowPoint - 1; i <= rowPoint + 1; i++)
            {
                if (i < 0 || i >= _board.Length)
                {
                    continue;
                }

                for (int j = colPoint - 1; j <= colPoint + 1; j++)
                {
                    if (j < 0 || j >= _board[0].Length)
                    {
                        continue;
                    }


                    if (_board[i][j] == "#")
                    {
                        result++;
                    }
                }
            }
            return result;
        }

    }
}


Measured memory_bytes: 15832
using System;

namespace _106C
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            long K = long.Parse(Console.ReadLine());
            char res = '1';
            for(int i = 0; i< Math.Min(K,S.Length);i++){
                if(S[i]!='1'){
                    res = S[i];break;
                }
            }
            Console.WriteLine(res);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	string s;
	cin>>s;
	ll q;
	cin>>q;
	string st[2];
	ll f=0,r=1;
	ll c=0;
	while(q--)
	{
		ll type;
		cin>>type;
		if(type==1)
		{
			c++;
			swap(f,r);
		}
		else
		{
			ll x;char c;
			cin>>x>>c;
			if(x==1)
				st[f].pb(c);
			else
				st[r].pb(c);
		}
	}
	if(c%2)
		reverse(all(s));
	reverse(all(st[f]));
	cout<<st[f]<<s<<st[r]<<"\n";
	return 0;
}

Measured memory_bytes: 1040
/* WORK HARD MAN ! IT DEFINETELY AIN'T EASY FOR THE PRIZE IT HOLDS .... */
/* GET YOUR ASS TO WORK ALREADY */
/* FALTU HI LIKH ... BUT KHALI NI BAITHNA */
#include<bits/stdc++.h>

#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cin.tie(nullptr);
#define int long long
#define ld long double
#define pb emplace_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)1e15
#define pii pair<int,int>
#define ff first
#define ss second
// #define N --

using namespace std;

int n, m, x;
vector<vector<int>> sk;
vector<int> a;

int skillUp() {
	int ans = inf;

	for (int i = 1; i < (1 << n); i++) {
		vector<int> v(m);
		int cost = 0;
		bool pos = 1;
		for (int j = 0; j < n; j++) {
			if (i & (1 << j)) {
				cost += a[j];
				for (int k = 0; k < m; k++)
					v[k] += sk[j][k];
			}
		}

		for (int i : v) {
			if (i < x) {
				pos = false;
				break;
			}
		}

		if (pos) ans = min(ans, cost);
	}

	return ans == inf ? -1 : ans;
}

/* if not able to handle the ques.. see up */
int32_t main() {
	fast
	int t_c = 1;
//	cin >> t_c;
	while (t_c--) {
		// cout << "#: ";
		cin >> n >> m >> x;
		a.resize(n), sk.resize(n, vector<int>(m));
		for (int i = 0; i < n; i++) {
			cin >> a[i];
			for (int j = 0; j < m; j++)
				cin >> sk[i][j];
		}

		cout << skillUp() << endl;
	}
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string a, b;
    cin >> a;
    cin >> b;
    if(a.size() == b.size()) {
        if(a[0] == b[0]) {
            cout << "EQUAL" << endl;
        }else if(a[0] > b[0]) {
            cout << "GREATER" << endl;
        }else {
            cout << "LESS" << endl;
        }
    } else if(a.size() > b.size()) {
            cout << "GREATER" << endl;
    } else {
            cout << "LESS" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int N,C[1005],c=0,t,p,cost=0;
long long res=0;
map<int,int>H;//number2order
map<int,int>rH;//order2number
P nodes[1005],tmp[1005];

int main()
{
	scanf("%d",&N);
	for(int i=0;i<N;i++)
		scanf("%d",C+i);
	for(int i=0;i<N;i++)
	{
		tmp[i].first=C[i];
		tmp[i].second=i;
	}
	sort(tmp,tmp+N);
	for(int i=0;i<N;i++)
	{
		nodes[i].first=C[i];
		nodes[tmp[i].second].second=i;
	}
	int s=tmp[0].first;
	for(int i=0;i<N;i++)
	{
		int j=nodes[i].second;
		if(j>=0&&j!=1)
		{
			int n=1,amin,sum;
			amin=sum=nodes[i].first;
			while(j!=i)
			{
				int next=nodes[j].second;
				if(nodes[j].second<amin)
					amin=nodes[j].first;
				sum+=nodes[j].first;
				n++;
				nodes[j].second=-1;
				j=next;
			}
			cost+=min(sum+(n-2)*amin,sum+amin+(n+1)*s);
		}
	}
	printf("%d\n",cost);
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h> 
#include <complex>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF LLONG_MAX
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

ll mpow(ll a, ll b){
	if(b==0) return 1;
	ll t1 = mpow(a,b/2);
	t1 *= t1;
	t1 %= MOD;
	if(b%2) t1 *= a;
	t1 %= MOD;
	return t1;
}

ll modinverse(ll a, ll m){
	ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) return 0; 
    while (a > 1){
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }
    if (x < 0) x += m0; 
    return x; 
}

ll range(ll l, ll r){
	return l + rand()%(r-l+1);
}

v64 fact;

ll ncr(ll n, ll r){
	if(r>n || r<0) return 0;
	ll num = fact[n];
	ll den = (fact[r]*fact[n-r])%MOD;
	ll ans = (num * mpow(den,MOD-2))%MOD;
	return ans;
}

void solve(){
	ll n,m;
	cin >> n >> m;
	fact.resize(3*m+n);
	fact[0]=1;
	forsn(i,1,3*m+n){
		fact[i]=(fact[i-1]*i)%MOD;
	}
	ll ans = ncr(n+3*m-1,3*m);
	// if((3*m+1)%2) ans *= -1;
	// cout << ans << ln;
	// if(m%2) 
	ans -= (n*ncr(n+m-2,m-1))%MOD;
	// else ans += (n*ncr(n+m-2,m-1))%MOD;
	for(ll i = m+2; i <= 3*m; i+=2){
		ans -= (ncr(n,i)*ncr(n+(3*m-i)/2-1,n-1))%MOD;
		ans %= MOD;
	}
	// cout << ans << ln;
	ans += MOD;
	ans %= MOD;
	cout << ans << ln;
}

int main()
{
	fast_cin();
    ll t=1;
    // cin >> t;
    forn(i,t) {
    	solve();
    }
    return 0;
}


Measured memory_bytes: 19840
#include <iostream>
#include <math.h>
using namespace std;
int main(void){
    string a,b;
    cin >> a >> b;
    
    int ab = stoi(a + b);
    
    if(int(sqrt(ab)) * int(sqrt(ab)) == ab){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
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);
}

void main()
{
    long N = lread();
    auto A = aryread();
    long[2] sum;
    A.sort();
    A.reverse();
    foreach (i, a; A)
    {
        sum[i & 1] += a;
    }
    writeln(abs(sum[0] - sum[1]));
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <numeric>
#include <ctime>
using namespace std;

int H[6][6] = {
    {1,5,2,3,0,4}, // North : 奥へ移動   ( y:-1 )
    {3,1,0,5,4,2}, // East  : 右へ移動   ( x:+1 )
    {2,1,5,0,4,3}, // West  : 左へ移動   ( x:-1 )
    {4,0,2,3,5,1}, // South : 手前へ移動 ( y:+1 )
    {0,2,4,1,3,5}, // Right : 右回りに回転 (移動なし)
    {0,3,1,4,2,5}  // Left  : 左回りに回転 (移動なし)
};

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

// サイコロライブラリ
// d[0] := top,   d[1] := front 
// d[2] := right, d[3] := left
// d[4] := back,  d[5] := bottom
enum{TOP, FRONT, RIGHT, LEFT, BACK, BOTTOM};
struct Cube{
    vector<int> d;
    // コンストラクタで初期化
    Cube(vector<int> v){
        if( v.size() == 6 )
            d = v;
        else
            d = vector<int>(6);
    }
    Cube(){ d = vector<int>(6); }
    // dirの方向に回転 (副作用なし)
    Cube roll(int dir) const {
        vector<int> d_(6);
        for(int i = 0 ; i < 6 ; i++ ){
            d_[i] = d[ H[dir][i] ];
        }
        return Cube(d_);
    }
};
// Cube の順序を定義 (map<Cube,T> を使いたいとき用)
bool operator<(const Cube& a, const Cube& b){
    if( a.d[0] == b.d[0] )
        return a.d[1] < b.d[1];
    return a.d[0] < b.d[0];
}

const int INF = 1e+8;
int m[10][10];
int w, h, sx, sy, gx, gy;
// d[y][x][top][front] := (x,y) にサイコロの上面がtop, 正面がfrontだったときの最小コスト
int d[10][10][10][10];

struct State{
	Cube c;
	int x, y, cost;
	State(){}
	State(Cube c_, int x_, int y_, int cost_){
		c = c_; x = x_; y = y_; cost = cost_;
	}
};
bool operator<(const State& a, const State& b){
	return a.cost > b.cost;
}

int solve(){
	// 初期化
	for(int y=0 ; y < 10 ; y++ ){
		for(int x=0 ; x < 10 ; x++ ){
			for(int i=0 ; i < 10 ; i++ ){
				fill(d[y][x][i], d[y][x][i]+10, INF);
			}
		}
	}
	vector<int> v(6);
	for(int i=0 ; i < 6 ; i++ ){
		v[i] = i+1;
	}
	d[sy][sx][1][2] = 0;
	priority_queue<State> q;
	q.push( State(Cube(v), sx, sy, 0) );
	int res = INF;
	while( !q.empty() ){
		int x = q.top().x;
		int y = q.top().y;
		int cost = q.top().cost;
		Cube c = q.top().c;
		q.pop();
		
		if( x == gx && y == gy ){
			res = cost;
			break;
		}
		
		for(int i=0 ; i < 4 ; i++ ){
			int mx = x + dx[i];
			int my = y + dy[i];
			if( mx < 0 || my < 0 || w <= mx || h <= my ) continue;
			Cube next = c.roll(i);
			int next_cost = cost + next.d[BOTTOM] * m[my][mx];
			int top = next.d[TOP];
			int front = next.d[FRONT];
			if( next_cost < d[my][mx][top][front] ){
				d[my][mx][top][front] = next_cost;
				q.push( State(next, mx, my, next_cost) );
			}
		}
	}
	return res;
}

int main(){
	while( cin >> h >> w , h || w ){
		for(int y=0 ; y < h ; y++ ){
			for(int x=0 ; x < w ; x++ ){
				cin >> m[y][x];
			}
		}
		cin >> sy >> sx >> gy >> gx;
		int ans = solve();
		cout << ans << endl;
	}
}

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

int main()
{
    int K, X;
    cin >> K >> X;
    int min = X - (K - 1);
    int max = X + (K - 1);
    for (int i = min; i <= max; i++)
    {
        cout << i << endl;
    }
}

Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v) { cout << v << endl; }
template <typename T> void in(T &v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
//  cout.precision(15); cout << fixed;

int main() {
  int n; cin >> n;
  if (n < 600) {
    print(8);
    return 0;
  }
  if (n < 800) {
    print(7);
    return 0;
  }
  if (n < 1000) {
    print(6);
    return 0;
  }
  if (n < 1200) {
    print(5);
    return 0;
  }
  if (n < 1400) {
    print(4);
    return 0;
  }
  if (n < 1600) {
    print(3);
    return 0;
  }
  if (n < 1800) {
    print(2);
    return 0;
  }
  
  print(1);
  return 0;
}


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

using namespace std;
using ll =long long;
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
#define leftunique(a) {sort((a).begin(),(a).end());(a).erase(unique((a).begin(),(a).end()),(a).end());}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
static const ll INF = 1LL << 60;
//Write From this Line

int main()
{
	int n;
	cin >> n;
	vector<vector<int>> f(n,vector<int>(10));
	rep(i,n) rep(j,10) cin >> f[i][j];
	vector<vector<int>> p(n,vector<int>(11));
	rep(i,n) rep(j,11) cin >> p[i][j];

	ll ans = -1001001001;
	//rep(i,n){
	//	rep(j,10){
	//		cout << f[i][j] << " ";
	//	}
	//	cout << endl;
	//}
	//rep(i,n){
	//	rep(j,11){
	//		cout << p[i][j] << " ";
	//	}
	//	cout << endl;
	//}
	for(int tmp = 1; tmp < (1 << 10); tmp++) {
		bitset<10> bit = tmp;
		ll sum = 0; // お姉ちゃんがbitのように営業したときの利益
		rep(i,n) {
			int count = 0; // 同時営業数
			rep(j,10) {
				if(bit.test(j) && f[i][j] == 1){
					count++;
				}
			}
			sum += p[i][count];
		}
		chmax(ans,sum);
	}
	cout << ans << endl;
}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())

#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int a, b, c;
    scanf("%d/%d/%d", &a, &b, &c);
    if (a < 2019)
    {
        cout << "Heisei" << endl;
        return 0;
    }
    if (a == 2019 && b <= 4)
    {
        cout << "Heisei" << endl;
        return 0;
    }
    cout << "TBD" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
typedef pair<ll, ll> P;
const ll INF = 1LL << 60;
//const int MOD = 1000000007;
const ll MOD=998244353;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

int main(){
  int h,w;
  cin>>h>>w;
  string t="snuke";
  for(int i=1;i<=h;i++){
    for(int j=1;j<=w;j++){
      string s;
      cin>>s;
      if(s==t){
        int x=j+64;
        char a=(char)x;
        cout<<a<<i<<endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3660
#include <stdio.h>

int main(){
    int a, b=0, c=0;
    scanf("%d", &a);
    
    if (a<105){
        b = 0;
    } else {
        for(int i=1; i<=a;i++){        
            if(i%2 == 0)
                continue;
            
            c = 0;
        
            for(int j=1;j<=i;j++){
                if(i%j==0)
                    c++;
                if (c>8)
                    break;
            }
        
            if (c==8)
                b++;
        }
    }
    
    printf("%d\n", b);
    
    return 0;
    
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}
long long gcd(long long x,long long y){
	return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
	return x/gcd(x,y)*y;
}

int main(void){
	int n=in(),h=in(),a[100000],b[100000],i,m=0,t,ans=0;
	rep(i,n){
		a[i]=in();
		b[i]=in();
		m=max(m,a[i]);
	}
	t=h;
	sort_r(b,n);
	for(i=0;i<n&&b[i]>=m;i++){
		ans++;
		t-=b[i];
		if(t<=0){
			print(ans);
			return 0;
		}
	}
	ans+=t/m+(!!(t%m));
	print(ans);
	return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
int N, X, ans;
vector<int> x;
int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}
void solve() {
    cin >> N >> X;
    x.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i];
    }
    for (int i = 0; i < N; i++) {
       ans = gcd(ans, x[i] - X);
    }
    cout << (ans > 0 ? ans : -ans) << endl;
    return;
}
//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}
int main(int args, char* argv[]) {
    solve();
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
using in = int64_t;
int main(){
 
  int n,d;
  cin >> n>>d;
vector<vector<int>> a(n,vector<int>(d));
  for(int i =0;i<n;i++){
   for(int j =0;j<d;j++){
   cin >>a.at(i).at(j);
   }
  }
  
int count =0; 
for(int i =0;i<n-1;i++){
for(int j =i+1;j<n;j++){
 
in dist2 =0;  
  for(int k =0;k<d;k++)
  dist2 += (a.at(i).at(k)-a.at(j).at(k)) *  (a.at(i).at(k)-a.at(j).at(k));
  
  int x =sqrt(dist2);
  if(x*x == dist2) count ++;
}
} 
  
  cout <<count <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

void white(int n,int A[]){
	int i;
	for(i=0;i<n-1;i++){
		printf("%d ",A[i]);
	}
	printf("%d\n",A[i]);
}

void insertionsort(int n,int A[]){
	int i,j,a;
	for(i=0;i<n;i++){
		for(j=0;j<i;j++){
			if(A[i]<A[j])
			{
				a=A[i];A[i]=A[j];A[j]=a;
			}
		}
	white(n,A);
	}
}

int main(){
	int i,n,A[100];
	scanf("%d",&n);
	for (i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	insertionsort(n,A);

	return 0;
}

Measured memory_bytes: 600
k=gets.split(' ').last.to_i
a=gets.split(' ').map(&:to_i)
b=gets.split(' ').map(&:to_i)
c=gets.split(' ').map(&:to_i)

puts a.product(b).map {|x,y|x+y }.max(k).product(c).map {|x,y|x+y }.max(k)


Measured memory_bytes: 232944
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

struct edge{int from,to,cost;};

class UF{
private:
	vector<int> par;
public:
	UF(int __size):par(__size){ rep(i,__size)par[i]=i; }
	
	int find(int x){
		if(par[x]==x) return x;
		else return par[x]=find(par[x]);
	}
	
	void unite(int x,int y){ par[find(y)]=find(x); }
};

int MSA(int r, int v, const vector<edge> &edges){
	int ret = 0;
	UF uf(v);
	vector<priority_queue<pii,vector<pii>,greater<pii>>> vpq(v);
	vector<int> lazy(v,0), state(v,0);
	
	for(auto e:edges){
		vpq[e.to].push(pii(e.cost,e.from));
	}
	state[r] = 2;
	
	rep(start,v){	//???????§??????????????????¨?????????
		int cur = uf.find(start);
		if(state[cur]!=0)continue;
		
		vector<int> processing, from(v,-1), from_cost(v,0);
		
		while(state[cur]!=2){
			processing.pb(cur);
			state[cur]=1;
			if( vpq[cur].empty() )return INF;	//??\?¬???°0????????????????????´????§?????????????
			
			pii e = vpq[cur].top(); vpq[cur].pop();
			from[cur] = e.second;
			from_cost[cur] = e.first+lazy[cur];
			if(cur==from[cur])continue;			//?????±??????????????????
			
			ret+=from_cost[cur];
			
			if(state[ from[cur] ]==1){	//???????????§????????¨???
				int p=cur;
				int par=cur;
				do{
					lazy[p] -= from_cost[p];
					
					if(p!=par){
						int tp=p;
						if(vpq[par].size()<vpq[tp].size())swap(par,tp);
						uf.unite(par,tp);
						while(!vpq[tp].empty()){	//?????¶?????¬????????????heap????????????
							pii t = vpq[tp].top();vpq[tp].pop();
							t.first+=lazy[tp]-lazy[par];
							vpq[par].push(t);
						}
					}
					p = from[p];
				}while(p!=cur);
				cur=par;
			}else{
				cur = from[cur];
			}
		}
		for(auto elm:processing)state[elm]=2;
	}
	return ret;
}

int main(){
	int e,v;
	int r;
	cin>>v>>e>>r;
 
	vector<edge> edges;
	rep(i,e){
		int s,t,w;
		cin>>s>>t>>w;
		edges.pb(edge{s,t,w});
	}
	cout<<MSA(r,v,edges)<<endl;
}

Measured memory_bytes: 3208
#include<iostream>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

uint64_t getZ() {
  uint64_t v = 0; int c;
  while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
  return v;
}

int64_t getN() {
  int c = getchar_unlocked();
  if(c == '-') return -getZ();
  int64_t v = c - '0';
  while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
  return v;
}

int X[10][10];

int main() {
  int N = getZ(), D = getZ();
  for(int i = 0; i < N; ++i) for(int j = 0; j < D; ++j) X[i][j] = getN();
  int ans = 0;
  for(int i = 0; i < N-1; ++i) for(int j = i; j < N; ++j) {
    int sum = 0;
    for(int k = 0; k < D; ++k) {
      int d = X[i][k] - X[j][k];
      sum += d*d;
    }
    for(int k = 1; k*k <= sum; ++k) if(k*k == sum) ++ans;
  }
  fin(ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>
#include <sstream>

using namespace std;

int main(){
  string s, ans="";

  cin >> s;

  ans += s[0];
  ans += to_string(s.size()-2);
  ans += s[s.size()-1];

  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Linq.Enumerable;
using static System.Math;

class Program
{
    static void Main()
    {
        var ABC = ReadLine().Split(' ').Select(int.Parse).ToArray();

        var (s, m, l) = ABC.OrderBy(x => x).ToArray();

        var ans = 0;

        while (m < l)
        {
            s++;
            m++;
            ans++;
        }

        while (s < m)
        {
            s += 2;
            ans++;
        }

        while(s > m)
        {
            m++;
            l++;
            ans++;
        }

        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 28480
#include <iostream>
#include <string>

using namespace std;

int main(){
    string str;
    cin >> str;
    for(int i = 0; i < str.size(); i++){
        if(i % 2){
            if(str[i] == 'R'){
                cout << "No\n";
                return 0;
            }
        }else{
            if(str[i] == 'L'){
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";
}

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

using namespace std;
using ll = long long;

int main() {
    int N, M;
    cin >> N >> M;
    vector<bitset<10>> s(N);
    bitset<10> mask;
    for(int i = M; i < 10; i++) mask[i] = true;

    for(int i = 0; i < M; i++) {
        int k;
        cin >> k;
        for(int j = 0; j < k; j++) {
            int ss;
            cin >> ss;
            s[ss - 1][i] = true;
        }
    }


    bitset<10> init;
    for(int i = 0; i < M; i++) {
        int j;
        cin >> j;
        if(j > 0) init[i] = false;
        else init[i] = true;
    }

    int res = 0;
    for(int i = 0; i < (1 << N); i++) {
        bitset<10> ptn(i);
        bitset<10> chk = init;
        for(int j = 0; j < N; j++) {
            if(ptn[j]) chk ^= s[j];
        }
        chk |= mask;
        if(chk.all()) res++;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;

int n,ma,mb;
int a[100];
int b[100];
int ans=1000000;
int c[100];
int dp[50][410][410];
int main()
{
	rep(i,50)rep(j,410)rep(k,410)dp[i][j][k]=-1;
	dp[0][0][0]=0;
	cin>>n;
	cin>>ma>>mb;
	rep(i,n)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	rep(i,n)
	{
		rep(j,410)
		{
			rep(k,410)
			{
				if(dp[i][j][k]!=-1)
				{
					if(dp[i+1][j][k]==-1||dp[i+1][j][k]>dp[i][j][k])dp[i+1][j][k]=dp[i][j][k];
					if(dp[i+1][j+a[i]][k+b[i]]==-1||dp[i+1][j+a[i]][k+b[i]]>dp[i][j][k]+c[i])dp[i+1][j+a[i]][k+b[i]]=dp[i][j][k]+c[i];
				}
			}
		}
	}
	rep(j,410)rep(k,410)
	{
		if(j*mb==k*ma&&dp[n][j][k]>=1)
		{
			ans=min(ans,dp[n][j][k]);
		}
	}
	if(ans==1000000)cout<<-1<<endl;
	else cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 33024
#include <stdio.h>
#include <math.h>

int main(void)
{
	int n, d, i, j, k;
	int sumCoordinate = 0;
	int count = 0;
	int x[10][10];

	scanf("%d%d", &n, &d);

	for (i = 0; i < n; i++) {
		for (j = 0; j < d; j++) {
			scanf("%d", &x[i][j]);
		}
	}

	//座標の距離を調べる
	for (i = 0; i < n - 1; i++) {
		for (j = i + 1; j < n; j++) {
			for (k = 0; k < d; k++) {
				//座標の差を合計する(sumCoordinate)
				sumCoordinate += (x[j][k] - x[i][k]) * (x[j][k] - x[i][k]);
			}
			//sumCoordinateの平方根が整数か調べる
			if (sqrt(sumCoordinate) == (int)sqrt(sumCoordinate)) {
				count++;//整数ならカウント
			}
			sumCoordinate = 0;
		}
	}
	
	printf("%d\n", count);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
// const int N = ;
using ll = long long;
using ii = pair <int , int>;
string s;

bool isPalindrome(int l , int r , string h) {
	if (l >= r) return true;
	return isPalindrome(l + 1 , r - 1 , h) && (h[l] == h[r]);
}

int main() {
	cin >> s;
	int n = s.length();
	string p,q;
	for (int i = 0 ; i < (n - 1) / 2 ; i++) p += s[i];
	for (int i = (n + 3) / 2 - 1 ; i < n ; i++) q += s[i];
	printf(isPalindrome(0 , n - 1 , s) && isPalindrome(0 , p.length() - 1 , p) && isPalindrome(0 , q.length() - 1 , q) ? "Yes\n" : "No\n");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, A;
    cin >> H >> A;
    cout << (H + A - 1) / A << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
	for (;;){
	int a,b,c[100000]={0},d=0,e=0,max=0;
			cin>>a>>b;
			if (a==0&&b==0)break;
			for (int A=0;A<a;A++){
			cin>>c[A];
			if (A>=b){
				for (int B=0;B<b;B++){
					d=d+c[A+e];
					e--;
				}
				if (max<d)max=d;
				d=0;
				e=0;
			}
		}
		cout<<max<<endl;
	}
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    string a, b, c;
    cin >> a >> b >> c;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        set<char> st;
        st.insert(a[i]);
        st.insert(b[i]);
        st.insert(c[i]);
        cnt += st.size() - 1;
    }
    cout << cnt << endl;
    return 0;
}

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

int main(void)
{
    int a, b;
    char op;

    while (cin >> a >> op >> b) {
        int res;
        switch (op) {
        case '+':
            res = a + b;
            break;
        case '-':
            res = a - b;
            break;
        case '*':
            res = a * b;
            break;
        case '/':
            res = a / b;
            break;
        case '?':
            goto end;
        }
        cout << res << endl;
    }

end:

    return 0;
}



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

string s, t;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> s >> t;
	int cnt = 0;
	for(int i = 0; i < (int)s.length(); i++)
		if(s[i] == t[i]) cnt++;
	cout << cnt << "\n";
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] args)throws Exception {

		   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	        while(true){
	        	String line = br.readLine();
	        	//文字列に先頭又は最後に空白文字がくっ付いている場合、それらを全て取り除く。
	        	line = line.trim();
	        	//半角スペースを区切り文字として扱う
	        	String[] readLineArray = line.split("[\\s+]");
	        	//変数に配列を代入
	        	int a = Integer.parseInt(readLineArray[0]);
	        	int b = Integer.parseInt(readLineArray[1]);
	        	if(a == 0 && b == 0){
	        		break;
	        	}
	        	for(int i = 1;i <= a;i++){
	        		for(int j = 1;j <= b; j++){
	        			if(j == 1 || j == b || i == 1 || i == a){
	        			System.out.printf("#");
	        			}else {
	        			System.out.printf(".");
	        			}
	        		}
	        		System.out.printf("\n");
	        	}
	        	System.out.printf("\n");
	        	
	        }

	}

}

Measured memory_bytes: 45816
n,t = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
tmp = 0
for i in range(n):
  if tmp >= a[i] + t:
    continue
  else:
    if a[i] > tmp:
      ans += t
    else:
      ans += a[i] + t - tmp
    tmp = a[i] + t
print(ans)

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

using namespace std;

#define ll long long
#define pb push_back
#define sz size()
#define ff first
#define ss second
#define mp make_pair

const int R = 105, C = 105;

int vis[R][C];
string s[R];

struct data
{
  int x, y, w;
  data(int x, int y, int w) : x(x), y(y), w(w) {};
};

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

int main() {

  int h, w;

  cin >> h >> w;

  for(int i = 0; i < h; i++){
    cin >> s[i];
    for(int j = 0; j < w; j++)vis[i][j] = INT_MAX;
  }
  queue<data>Q;
  if(s[0][0] == '#'){
    vis[0][0] = 1;
    Q.push({0, 0, 1});
  }
  else {
    vis[0][0] = 0;
    Q.push({0, 0, 0});
  }

  while(!Q.empty()){
    auto u = Q.front();
    Q.pop();

    // cout << u.x << ' ' << u.y << ' ' << u.w << endl;

    for(int i = 0; i < 2; i++){
      int vx = u.x + dx[i], vy = u.y + dy[i];
      if(vx < 0 || vy < 0 || vx >= h || vy >= w)continue;

      if(s[vx][vy] == '#'){
        if(u.w){
          if(vis[vx][vy] > vis[u.x][u.y]){
            vis[vx][vy] = vis[u.x][u.y];
            Q.push({vx, vy, 1});
          }
        }
        else {
          if(vis[vx][vy] > vis[u.x][u.y] + 1){
            vis[vx][vy] = vis[u.x][u.y] + 1;
            Q.push({vx, vy, 1});
          }
        }
      }

      else {
        if(vis[vx][vy] > vis[u.x][u.y]){
          vis[vx][vy] = vis[u.x][u.y];
          Q.push({vx, vy, 0});
        }
      }
    }
  }
  cout << vis[h - 1][w - 1] << endl;

  return 0;
}

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

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;

#define faster ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define debug(x) cout<<#x<<" = "<<(x)<< endl
#define nl "\n"
#define sp " "

const int MOD = 1e9 + 7, SZ = 5e5 + 5;
int fact[SZ], N, M;


ll powmodk(ll a, ll k, ll m) {
    if (k == 0) return 1;
    ll r = powmodk(a, k / 2, m);
    r = (r * r) % m;
    if (k % 2) r = (r * a) % m;
    return r;
}

inline ll fix(ll x){
	return (x % MOD + MOD) % MOD;
}

inline ll modinverse(ll a) {
    return powmodk(fix(a), MOD - 2, MOD);
}

ll nck(int n, int k){
	if(k > n) return 0;
	ll num = fact[n];
	ll den = modinverse(1LL * fact[n - k] * fact[k]);
	return fix(num * den);
}

ll npk(int n, int k){
	return fix(nck(n,k) * fact[k]);
}

int main() {
	faster
	cin >> N >> M;

	fact[0] = 1;
	for(int i = 1; i < SZ; i++){
		fact[i] = fix(1LL * i * fact[i - 1]);
	}

	ll ans = npk(M,N);
	ll cur = 0;
	for(ll s = 1, i = 0; i <= N; i++, s = -s){
		cur += s * nck(N,i) * npk(M - i, N - i);
		cur = fix(cur);
	}

	cout << fix(ans * cur) << nl;
}


Measured memory_bytes: 5536
#include <iostream>
#include <string>

using namespace std;

int main(int argc, const char *argv[])
{
  int a, b;
  cin >> a >> b;
  
  b--;
  a--;
  int cnt = b / a;
  if (b % a > 0) {
    cnt++;
  }

  cout << cnt << "\n";
}

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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, d, x; cin >> n >> d >> x;
	x += n;
	d--;
	rep(i, n) {
		int a; cin >> a;
		x += d / a;
	}
	cout << x << endl;
}

Measured memory_bytes: 256