akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DRoadToMillionaire solver = new DRoadToMillionaire();
        solver.solve(1, in, out);
        out.close();
    }

    static class DRoadToMillionaire {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.readIntArray(n);

            long[] answer = new long[n];
            answer[0] = 1000;

            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    long x = answer[i];
                    answer[j] = Math.max(answer[j], x);
                    long stocks = x / a[i];
                    x -= stocks * a[i];
                    x += stocks * a[j];
                    answer[j] = Math.max(answer[j], x);
                }
            }

            out.println(answer[n - 1]);
        }

    }

    static class InputReader {
        public final BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] readIntArray(int n) {
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextInt();
            }
            return x;
        }

    }
}



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

#define For(i,a,b) for(int (i) = (a);(i) < (b);i += 1)
#define Rep(i,n) For((i),0,(n))
#define All(a) (a).begin(),(a).end()
#define sp " "
#define INF 1e18
#define INT_INF 1e9
#define MAX_N 100000

typedef long long ll;
const ll MOD = 1000000007;
const ll MOD_9 = 998244353;

int main(){
    ll A,B,K;
    cin >> A >> B >> K;
    B = max(0ll,min(B,B-(K-A)));
    A = max(0ll,A-K);
    cout << A << sp << B << endl;
    //cin >> A;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>  // istringstream
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main()
{   
    char c;
    cin >> c;

    if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o'){
        cout << "vowel" << endl;
    }
    else{
        cout << "consonant" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x[] = new int[n];
		double sum = 0;
		
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
			sum += x[i];
		}
		
		sum /= n;
		
		int p;
		
		if (Math.ceil(sum) - sum >= sum - Math.floor(sum)){
			p = (int) Math.floor(sum);
		} else {
			p = (int) Math.ceil(sum);
		}
		
		long ans = 0;
		
		for (int i = 0; i < n; i++) {
			ans += Math.pow(x[i] - p, 2);
		}
		
		System.out.println(ans);
		
		sc.close();
    }
}



Measured memory_bytes: 36044
N = int(input())
S = input()

if(N%2 == 0):
  #Pythonでは、//で整数の商、%で余り（剰余、mod）が算出
  n = N//2
  #[:n] 0~n-1 [n:] n~最後まで
  if(S[:n] == S[n:]):
    print("Yes")
  else:
    print("No")
else:
  print("No")

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

int N, M;
string str, str2;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	cin >> N >> M;
	cin >> str;
	cin >> str2;
	int gcd = __gcd(N, M);
	N /= gcd;
	M /= gcd;
	int i = 0, j = 0;
	while (i < (int)str.length()) {
		if (str[i] != str2[j]) {
			cout << "-1\n";
			return 0;
		}
		i += N;
		j += M;
	}
	cout << (long long)N*M*gcd << "\n";
	
	return 0;
}


Measured memory_bytes: 640
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

void Main()
{
	string day;
  	cin >> day;
  	int ans;
  	if (day == "SAT"){
        ans = 1;
    }
  	else if(day == "FRI"){
        ans = 2; 
    }
  	else if(day == "THU"){
        ans = 3; 
    }
    else if(day == "WED"){
        ans = 4; 
    }
  	else if(day == "TUE"){
        ans = 5; 
    }
  	else if(day == "MON"){
        ans = 6; 
    }
  	else if(day == "SUN"){
        ans = 7; 
    }
	 cout << ans << endl;
	return;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

int main(int argc,char **argv){
  int32_t n,x;
  std::cin>>n>>x;

  int k=0,t;
  for(int i=0;i<n;i++){
    std::cin>>t;
    k+=t;
    if(k>x){
      std::cout<<i+1<<std::endl;
      return 0;
    }
  }
  std::cout<<n+1<<std::endl;
  
  return 0;
}


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

long long mod;
#define MAX_N 200010
long long inv[MAX_N];
long long factorial[MAX_N];
long long inv_factorial[MAX_N];

void GetInv(){
    for (int i = 1; i < MAX_N; i++) {
        if (i == 1) inv[i] = 1;
        else {
            inv[i] = (mod - (mod / i) * inv[mod % i]) % mod;
            if (inv[i] < 0) inv[i] += mod;
        }
    }
}
void GetFactorial(){
    factorial[0] = 1; inv_factorial[0] = 1;
    for (int i = 1; i < MAX_N; i++) {
        factorial[i] = factorial[i-1] * i;
        factorial[i] %= mod;
        inv_factorial[i] = inv_factorial[i-1] * inv[i];
        inv_factorial[i] %= mod;
    }
}

long long combination(int n, int r) {
    long long ret = factorial[n] * inv_factorial[r];
    ret %= mod;
    ret *= inv_factorial[n-r];
    return ret % mod;
}

int main() {
    cin >> mod;
    GetInv(); GetFactorial();
    vector<long long> b(mod, 0);
    for (int i = 0; i < mod; i++) {
        int c; cin >> c;
        if (!c) continue;
        b[0] += 1; b[0] %= mod;
        long long q = 1;
        long long j = mod - i;
        for (int k = mod-1; k >= 0; k--) {
            b[k] += mod - combination(mod-1, k) * q % mod;
            b[k] %= mod;
            q = q * j % mod;
        }
    }
    for (int i = 0; i < mod; i++) {
        if (i) cout << " ";
        cout << b[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
#define gc getchar()
#define N 100010
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x
#define sp <<" "
#define ln <<endl
using namespace std;
inline int inn()
{
	int x,ch;while((ch=gc)<'0'||ch>'9');
	x=ch^'0';while((ch=gc)>='0'&&ch<='9')
		x=(x<<1)+(x<<3)+(ch^'0');return x;
}
int no_ans,f[N],g[N];vector<int> t[N];
int dfs(int x,int fa=0)
{
	if(no_ans) return 0;int n=(int)t[x].size();
	if(fa&&n==1) return f[x]=1,g[x]=0;int c=0,fc=0;
	for(int i=0,y;i<n;i++) if((y=t[x][i])^fa)
		dfs(y,x),c+=(g[y]==0),fc|=f[y];
	if(c==0) f[x]=1,g[x]=fc;
	else if(c==1) f[x]=0,g[x]=1;
	else f[x]=g[x]=0,no_ans=1;
	return 0;
}
int main()
{
	int n=inn();if(n&1) return !printf("First\n");
	for(int i=1,u,v;i<n;i++) u=inn(),v=inn(),t[u].pb(v),t[v].pb(u);
	return dfs(1),!printf("%s\n",(no_ans||!g[1])?"First":"Second");
}

Measured memory_bytes: 6528
import unittest


class TestA(unittest.TestCase):
    def test_1(self):
        self.assertEqual(
            think([10, 30, 40, 20]),
            30
        )

    def test_2(self):
        self.assertEqual(
            think([10, 10]),
            0
        )

    def test_3(self):
        self.assertEqual(
            think([30, 10, 60, 10, 60, 50]),
            40
        )


def solve():
    h = read()
    result = think(h)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return read_type(int, n, sep=' ')


def read_float(n):
    return read_type(float, n, sep=' ')


def read_type(t, n, sep):
    return list(map(lambda x: t(x), read_line().split(sep)))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(h):
    n_max = 10 ** 5
    h_max = 10 ** 4

    dp = [h_max * n_max for i in range(len(h))]
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])

    for i in range(2, len(h)):
        dp[i] = min(
                    abs(h[i] - h[i - 1]) + dp[i - 1],
                    abs(h[i] - h[i - 2]) + dp[i - 2]
                )

    return dp[len(h) - 1]


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

Measured memory_bytes: 67048
N = int(input())
a = list(map(int, input().split()))

if 1 not in a:
  print(-1)
else:
  # 数値はあるパターン
  break_num = 0  # 壊した数
  before = 0  # 前回の数字があった場所
  search = 1  # 探している数
  
  for i in range(N):
    if search == a[i]:
      # print("now in", i,  "before", before, "then minus", (i - before))
      break_num += (i - before) - 1
      before = i
      search += 1

  break_num += (N - before)
  print(break_num)

Measured memory_bytes: 26268
n, k = map(int, input().split())
dict_num = {}
for i in range(n):
  a, b = map(int, input().split())
  if a not in dict_num:
    dict_num[a] = b
  else:
    dict_num[a] += b

sort_dict_num = sorted(dict_num.items(), key=lambda x:x[0])
checked = 0
for key, v in sort_dict_num:
  if checked < k <= checked + v:
    print(key)
    exit()
  else:
    checked += v

Measured memory_bytes: 15044
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll w1 = 0;
    ll w2 = 0;
    ll w3 = 0;
    for(int i = 0; i < n; i++)
    {
        if(s[i] == 'R')
        {
            w1++;
        }
        if(s[i] == 'G')
        {
            w2++;
        }
        if(s[i] == 'B')
        {
            w3++;
        }
    }
    ll sum = w1 * w2 * w3;
    ll ans = 0;
    vector<char> V;
    for(int i = 1; i <= n / 2; i++)
    {
        for(int k = 0; k < i; k++)
        {
            V.clear();
            for(int j = k; j < n; j = j + i)
            {
                if(V.size() > 1)
                {
                    //cout << s[j] << V[V.size() - 1] << V[V.size() - 2] << "\n";
                    //cout << i << " " << k << " "<<  j << " " << j - i << " " << j - i - i << "\n";
                    if(s[j] != V[V.size() - 1] && s[j] != V[V.size() - 2] && V[V.size() - 1] != V[V.size() - 2])
                    {
                        ans++;
                    }
                }
                V.push_back(s[j]);
            }
        }

    }
    cout << sum  - ans << "\n";
    //cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3660
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var L = Sarray()[0];

            long vNum = 1;
            while ((long)Pow(2, vNum) - 1 <= L - 1) ++vNum;
            var rem = L - 1 - ((long)Pow(2, vNum - 1) - 1);
            var graph = new long[vNum].Select(_ => new List<(long n, long l)>()).ToArray();
            for (var i = 0; i < vNum - 1; ++i)
            {
                graph[i].Add((i + 1, 0));
                graph[i].Add((i + 1, (long)Pow(2, i)));
            }

            var len = (long)Pow(2, vNum - 1);
            for (var i = vNum - 2; 0 <= i; --i)
            {
                var e = (long)Pow(2, i);
                if (e <= rem)
                {
                    rem -= e;
                    graph[i].Add((vNum - 1, len));
                    len += e;
                }
            }
            var cnt = 0L;
            foreach (var g in graph)
                cnt += g.Count;
            WriteLine($"{vNum} {cnt}");
            for (var i = 0; i < vNum - 1; ++i)
                foreach (var l in graph[i])
                    WriteLine($"{i + 1} {l.n + 1} {l.l}");
        }


        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28768
#include<bits/stdc++.h>
const int inf=0x0f0f0f0f;
int ans=inf,n;
char A[2007],B[2007];
int pos[2007];
int pos2[2007],p1[2007];
void mins(int&a,int b){if(a>b)a=b;}
void maxs(int&a,int b){if(a<b)a=b;}
void cal(){
	for(int i=0;i<n;++i)pos[i]=pos2[i]=inf;
	for(int i=0;i<n;++i){
		int c=i;
		for(int j=0;j<n;++j){
			if(B[j]=='1'&&pos[j]==inf)pos[j]=i;
		}
		B[n]=B[0];
		for(int j=0;j<n;++j)B[j]=B[j+1];
	}
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			if(B[j]=='1'&&pos2[j]==inf)pos2[j]=i;
		}
		for(int j=n;j;--j)B[j]=B[j-1];
		B[0]=B[n];
	}
//	for(int i=0;i<n;++i)printf("(%d,%d)",pos[i],pos2[i]);puts("");
	for(int i=0;i<n;++i){
		int c1=0;
		int d1=0;
		memset(p1,0,sizeof(p1));
		for(int j=0;j<n;++j)if(A[j]!=B[j]){
			++c1;
			if(pos[j]==inf)goto un;
			if(pos[j]<=i)continue;
			maxs(p1[pos[j]-i],pos2[j]);
		}
		for(int j=n-1;j>=0;--j){
			mins(ans,i+d1*2+j*2+c1);
			maxs(d1,p1[j]);
		}
		un:
		B[n]=B[0];
		for(int j=0;j<n;++j)B[j]=B[j+1];
	}
}
int main(){
	scanf("%s%s",A,B);
	n=strlen(A);
	cal();
	std::reverse(A,A+n);
	std::reverse(B,B+n);
	cal(); 
	if(ans>=inf)ans=-1;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
using ll = long long;
int main() {
	int N, M;
	cin >> N >> M;
	int x = 1;
	for (int i = 0; i < M; ++i) {
		x *= 2;
	}
	cout << x * (1900 * M + 100 * (N - M)) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val A = sc.nextInt()
    val B = sc.nextInt()
    for (i in 1..1000000) {
        if (i * 8 / 100 == A && i * 10 / 100 == B) {
            println(i)
            return
        }
    }
    println(-1)
}

Measured memory_bytes: 31384
#include <cstdio>
#include <random>
#include <cassert>
#include <algorithm> 
#include <iostream>
#include <chrono>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 998244353;
int dp[3003][3003], up[3003][3003], r[3003][3003];

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    dp[a][b] = 1;
    for(int i = a + 1; i <= c; ++i) {
        dp[i][b] = dp[i - 1][b] * b % M;
    }
    for(int i = b + 1; i <= d; ++i) {
        dp[a][i] = dp[a][i - 1] * a % M;
    }
    for(int i = a + 1;  i <= c; ++i) {
        for(int j = b + 1; j <= d; ++j) {
            dp[i][j] = dp[i - 1][j] * j + dp[i][j - 1] + up[i][j - 1] * (i - 1);
            dp[i][j] %= M;
            up[i][j] = up[i][j - 1] * (i - 1) + dp[i][j - 1];
            up[i][j] %= M;
        }
    }
    cout << dp[c][d] << endl;
    return 0;
}

Measured memory_bytes: 144224
import sys
input = sys.stdin.buffer.readline
from itertools import accumulate
n=int(input())
LR=[list(map(int,input().split())) for _ in range(n)]
ans=max(r-l+1 for l,r in LR)+max(0,min(r for l,r in LR)-max(l for l,r in LR)+1)
LR.sort()
R_min=list(accumulate([r for l,r in LR],min))
R_min_r=list(accumulate([r for l,r in LR[::-1]],min))[::-1]
_ans=0
for i in range(n-1):
	_ans=max(_ans,max(0,R_min[i]-LR[i][0]+1)+max(0,R_min_r[i+1]-LR[-1][0]+1))
print(max(ans,_ans))

Measured memory_bytes: 30588
#include<cstdio>
#include<algorithm>

#define INF 1000000000

using namespace std;

int N;
int cost[128][128];
int d[128];
bool used[128];

void dijkstra(int s){
	//ツ渉可甘コツ可サ
	for(int i= 0; i < 128; i++){
		d[i] = INF;
		used[i] = false;
	}
	
	d[s] = 0;
	
	while(true){
		int v = -1;
		
		for(int i = 1; i <= N; i++){
			if(!used[i] && (v == -1 || d[i] < d[v]))v = i;
		}
		
		if(v == -1)break;
		
		used[v] = true;
		
		for(int i = 1; i <= N; i++){
			d[i] = min(d[i],d[v] + cost[v][i]);
		}
	}
}
	





int main(void){
	
	while(scanf("%d", &N) != EOF){
		int P;
		int r1,k1,t;
		int s1,d1,v1;
		
		for(int i = 0; i < 128; i++){
			for(int j = 0; j < 128; j++){
				cost[i][j] = INF;
			}
		}
		
		//ツδ仰ーツタツづ個禿偲ヲ
		for(int i = 0; i < N; i++){
			scanf("%d %d", &r1, &k1);
			for(int j = 0; j < k1; j++){
				scanf("%d", &t);
				cost[r1][t]=1;
			}
		}
		
		//ツパツケツッツトツづ個禿偲ヲ
		scanf("%d", &P);
		for(int i = 0; i < P; i++){
			scanf("%d%d%d", &s1, &d1, &v1);
			dijkstra(s1);
			
//			for(int j = 1; j < N; j++)printf("%d\n", d[i]);
			if(v1 - d[d1] > 0){
				printf("%d\n",d[d1]+1);
			}else {
				puts("NA");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 828
import collections
n = int(input())
S = []
for i in range(n):
    s = collections.Counter(input())
    S.append(s)
ans = ''
for key in S[0].keys():
    cnt = S[0][key]
    for i in range(1,n):
        cnt = min(cnt,S[i][key])
    for i in range(cnt):
        ans += key
ans = sorted(ans)
print(''.join(ans))

Measured memory_bytes: 9420
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int len, k;
    cin >> len >> k;
    len--;
    k--;
    if(len % k == 0)
        cout << len / k;
    else
        cout << (len / k) + 1;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  ll x,y;
  cin>>x>>y;
  ll count=0;
  for(ll i=x;i<=y;i=i*2)
  {
    
    
    
    if(i<=y)
      count++;
    else
      break;
  
  
}
  cout<<count<<endl;
}


Measured memory_bytes: 3612
var c:char;
    n,ans:integer;

function ifThen(p:boolean;t,f:integer):integer;
begin
  if p then ifThen := t else ifThen := f
end;

function CharToInt(c:char):integer;
begin
  CharToInt := Ord(c)-Ord('0')
end;

function eolnread:boolean;
begin
  if eoln then eolnread:=false else begin
  read(c);
  eolnread:=true
  end
end;

begin
  n := 0;
  ans := 0;
  while eolnread do begin
    n := n + 1;
    ans := ans + (CharToInt(c) xor n mod 2);
  end;
  writeln(ifThen(ans*2<n,ans,n-ans));
end.

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>

int main(void){
 char s;
 s=fgetc(stdin);
 if(s=='a' || s=='i' || s=='u' || s=='e' || s=='o'){
  printf("vowel");
 }else{
 printf("consonant");
}
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main() {
    long long n,a;
    vector<long long> v,vf,vb;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a;
        v.push_back(a);
        if(i==0)vf.push_back(a);
        else vf.push_back(vf[i-1]+a);
    }
    vf.pop_back();
    reverse(begin(v),end(v));
    for(unsigned i=0;i<v.size();i++){
        if(i==0)vb.push_back(v[i]);
        else vb.push_back(vb[i-1]+v[i]);
    }
    vb.pop_back();
    reverse(begin(vb),end(vb));
    long long temp=0,ans = 100000000000;
    for(unsigned i=0;i<vf.size();i++){
        temp = abs(vf[i]-vb[i]);
        if(ans > temp)ans = temp;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){

  int a=0;
  int b=0;
  string S,T;
  string U;
  
  cin>>S>>T;
  cin>>a>>b;
  cin>>U;
  
  if(S==U)cout<<a-1<<" "<<b;
  if(T==U)cout<<a<<" "<<b-1;
  
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n = sc.nextInt();
        ArrayList<Integer> e[] = new ArrayList[n];
        for (int i = 0; i < e.length; i++) {
			e[i]=new ArrayList<>();
		}
        for (int i = 0; i < n-1; i++) {
			int x=sc.nextInt();
			int y=sc.nextInt();
			int w=sc.nextInt(), f=1;
			if(w%2==1)f=-1;
			e[x-1].add(y*f);
			e[y-1].add(x*f);
		}
        
        boolean u[]=new boolean[n];
        LinkedList<P> q = new LinkedList<>();
        q.add(new P(0,0));
        int color[]=new int[n];

        while(!q.isEmpty()) {
        	P p=q.poll();
        	int id=p.id;
        	u[id]=true;
        	for (int i = 0; i < e[id].size(); i++) {
				int to = e[id].get(i), abs=abs(to);
//				db(id,to,abs);
				if(u[abs-1])continue;
				int col=0;
				if(p.d==0 && to<0)col=1;
				else if(p.d==1 && to>0)col=1;
				color[abs-1]=col;
				u[abs-1]=true;
				q.add(new P(abs-1, col));
			}
        }

        for (int i = 0; i < color.length; i++) {
        	out.println(color[i]);
		}
//        out.println();
        out.flush();
    }
    



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

class P {
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
}

//class P implements Comparable<P>{
//    int id,T;
//    P(int id, int T) {
//        this.id=id;
//        this.T=T;
//    }
//    public int compareTo(P p){
//        return id-p.id; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 56436
<?php

while (true) {
    $n = trim(fgets(STDIN));
    if ($n == 0) break;
    unset($v);

    $grp = "";
    for ($i = 0; $i < $n; $i++) {
        $line = trim(fgets(STDIN));
        $line = substr($line, 0, -1);
        $arr = explode(':', $line);
        if ($i == 0) {
            $grp = $arr[0];
        }
        $v[$arr[0]] = explode(',', $arr[1]);
    }

    $changed = true;
    while ($changed) {
        $changed = false;
        foreach ($v[$grp] as $k => $g) {
            if (isset($v[$g])) {
                unset($v[$grp][$k]);
                $v[$grp] = array_merge($v[$grp], $v[$g]);
                $v[$grp] = array_unique($v[$grp]);
                $changed = true;
                break;;
            }
        }
    }
    $v[$grp] = array_unique($v[$grp]);

    echo count($v[$grp])."\n";
}

Measured memory_bytes: 15808
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

typedef struct{
  double x,y;
}point;
  
void koch(point p1,point p2,int n,int i,int angle){
  point s,t,u;
  double r=sqrt(((p2.x-p1.x)*(p2.x-p1.x)+(p2.y-p1.y)*(p2.y-p1.y)))/3;

  if (n<i)return;
  //  cout << "dbg" << p1.x << " " << p1.y << " " << p2.x << " " << p2.y << " " << endl;

  s.x=(p2.x-p1.x)/3+p1.x;
  s.y=(p2.y-p1.y)/3+p1.y;
  t.x=(p2.x-p1.x)*2/3+p1.x;
  t.y=(p2.y-p1.y)*2/3+p1.y;
  //cout << "dbg" << r << " " << cos(i*M_PI/3) << endl;
  u.x=r*cos(angle*M_PI/3)+s.x;
  u.y=r*sin(angle*M_PI/3)+s.y;

  //  cout << p1.x << " " << p1.y << endl;
  koch(p1,s,n-1,i,angle);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(s,u,n,i+1,angle+1);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(u,t,n,i+1,angle-1);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(t,p2,n-1,i,angle);
  //  cout << p2.x << " " << p2.y << endl; 
}

int main(){
  int n;
  point p1={0,0},p2={100,0};
  
  cin >> n;
  cout << p1.x << " " << p1.y << endl;
  koch(p1,p2,n,1,1);
  cout << p2.x << " " << p2.y << endl; 

  return 0;
}

Measured memory_bytes: 3576
#include<iostream>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <algorithm>
using namespace std;
#include <cmath>
#include <string>
#define elif else if

//
// void printBoard(bool *board,int N,int M ){
//   for(int ii=1;ii<N+1;ii++){
//     for(int jj=1;jj<M+1;jj++){
//       cout<<board[ii][jj]<<" ";
//     }
//     cout<<endl;
//   }
//
// }


int main(void) {
  ios::sync_with_stdio(false);
  long long  N,M;
  cin>>N>>M;
  if(M<N){
    long long tmp = M;
    M = N;
    N = tmp;
  }
  long long count;
  if(N==1&&M==1){
    count = 1;
  }elif(N==1){
    count = M-2;
  }else{
    count = (M-2)*(N-2);
  }

  cout<<count<<endl;
  return 0;
}


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

using namespace std;

class TeamInfo {
public:
	string name;
	int totalScore;
};

TeamInfo TeamData[10];

bool cmp(const TeamInfo &t1, const TeamInfo &t2) {
	return t1.totalScore > t2.totalScore;
}

int main() {
	int n, w, l, d;
	bool flag = false;

	while (cin >> n, n) {
		//memset(TeamData, 0, sizeof(TeamData));
		if (flag) {
			cout << endl;
		}
		for (int i = 0; i < n; i++) {
			cin >> TeamData[i].name;
			cin >> w >> l >> d;
			TeamData[i].totalScore = w * 3 + d;
		}
		sort(TeamData, TeamData + n, cmp);
		for (int i = 0; i < n; i++) {
			cout << TeamData[i].name << "," << TeamData[i].totalScore << endl;
		}
		flag = true;
	}

	return 0;
}


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

if N==1:
  print(1)
  exit()

A = [0]*N
a_prev = None
for i in range(M):
  a_i = int(input())
  if a_prev == a_i:
    print(0)
    exit()
  A[a_i] = 1  
  a_prev = a_i

N_2 = 1
N_1 = 1  
ans = 0
for i in range(1, N):
  if A[i]==1:
    N_1 = 0
  ans = (N_1 + N_2)%1000000007
  N_2 = N_1
  N_1 = ans
print(ans)


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
int main() {
	char c1, c2;
    cin >> c1 >> c2;
    if (c1=='M')
      	cout << 6;
    if (c1=='T' && c2=='U')
      	cout << 5;
    if (c1=='W')
      	cout << 4;
    if (c1=='T' && c2=='H')
      	cout << 3;
    if (c1=='F')
      	cout << 2;
    if (c1=='S' && c2=='A')
      	cout << 1;
    if (c1=='S' && c2=='U')
      	cout << 7;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int A,B,C,D;
  	cin >> A >> B >> C >> D;
  	if (A+B>C+D){
      cout << "Left" << endl;
    }
    else if (A+B==C+D){
      cout << "Balanced" << endl;
    }
  	else if (A+B<C+D){
      cout << "Right" << endl;
    }
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    sort(p.begin(), p.end());
    int sum = 0;
    rep(i, k) {
        sum += p[i];
    }
    println(sum)
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
    int n;
    cin>>n;
    int sum=0,maxv=0;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        sum+=a;
        maxv=max(maxv,a);
    }
    if(sum-maxv>maxv)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3640
from fractions import gcd
N=int(input())
A=list(map(int,input().split()))
L=[0]*(N+1)
R=[0]*(N+1)
for i in range(N):
  L[i+1]=gcd(L[i],A[i])
  R[N-1-i]=gcd(R[N-i],A[N-1-i])
print(max([gcd(L[i],R[i+1]) for i in range(N)]))

Measured memory_bytes: 16144
package main

import "fmt"

func main() {
	var a,b,c,d int
	fmt.Scan(&a,&b,&c,&d)

	cnt := 0
	for i := 0; i <= 100; i++ {
		if a <= i  && b > i {
			if c <= i  && d > i {
				cnt++
			}

		}
	}
	fmt.Println(cnt)
}


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
W=LIST()

A=0
B=sum(W)
ans=abs(A-B)
for i in range(N):
    A+=W[i]
    B-=W[i]
    ans=min(ans, abs(A-B))
print(ans)


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

long long n, p;

int main() {
	cin >> n >> p; p /= 1000;
	for (int i = 0; i <= n; i++) {
		long long rem = p - i * 10, r2 = n - i; if (rem < 0) continue;
		long long minx = r2 * 1, maxx = r2 * 5;
		if (rem < minx || maxx < rem) continue;
		if ((rem - minx) % 4 != 0) continue;
		int p = i, q = (rem - minx) / 4, r = n - p - q;
		cout << p << " " << q << " " << r << endl;
		return 0;
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};

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

const int MAX_N=200000;
int N,K;
int A[MAX_N+5];

int res[MAX_N+5];

signed main(){
    cin>>N>>K;
    for(int i=1;i<=N;++i)cin>>A[i];
    for(int i=0;i<K;++i){
        int minA=INF;
        for(int j=1;j<=N;++j){
            int l=max(1ll,j-A[j]),r=min(N,j+A[j]);
            res[l]++;
            res[r+1]--;
        }
        for(int j=1;j<=N;++j)res[j]+=res[j-1];
        for(int j=1;j<=N;++j){
            A[j]=min(N,res[j]);
            chmin(minA,A[j]);
            res[j]=0;
        }
        if(minA==N)break;
    }
    for(int i=1;i<=N;++i)cout<<A[i]<<" ";
    cout<<endl;
}

Measured memory_bytes: 6716
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		if((A*B*1)%2!=0||(A*B*2)%2!=0||(A*B*3)%2!=0){ 
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define maxn 105
using namespace std;
int n,a[maxn],b[maxn],ans=0;
int main()
{
	cin>>n;
	for(int i=1;i<n;++i) cin>>a[i];
	b[1]=a[1],b[2]=a[1];
	for(int i=2;i<n;++i) 
	{
		b[i+1]=a[i];
		b[i]=min(a[i-1],a[i]);
	}
	for(int i=1;i<=n;++i) ans+=b[i];
	cout<<ans<<endl;
	return 0;
}

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

typedef long long ll;

int main() {
	ll n;
	cin >> n;
	ll sum = 0;

	rep(i, n + 1) {
		if (i % 3 != 0 && i % 5 != 0)
			sum += i;
	}
	cout << sum << endl;

	return 0;
}

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

int main(){
  int totalTown,totalRoad;
  cin >> totalTown >> totalRoad;
  
  vector<int> roadCount(totalTown,0);
  
  for(int i = 0; i < totalRoad; i++){
    int nowTown = 0,nowRoad = 0;
    cin >> nowTown >> nowRoad;
    
    roadCount.at(nowTown -1)++;
    roadCount.at(nowRoad -1)++;
  }
  
  for(int i = 0; i < roadCount.size(); i++){
    cout << roadCount.at(i) << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define ll long long
const int N=1e5+5;
using namespace std;
int n,m,i,x,y,fx[N];
ll f[N],ans;
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
void add_f(int l,int r,int k){f[l]+=k;f[r+1]-=k;}
void add_fx(int l,int r,int k){fx[l]+=k;fx[r+1]-=k;}
int main(){
	n=read();m=read();y=read();
	for (n--;n--;){
		x=y;y=read();
		if (x<=y){
			add_f(1,x,y-x);
			add_f(x+1,y,y+1);add_fx(x+1,y,-1);
			add_f(y+1,m,y-x);
		}
		else{
			add_f(1,y,y+1);add_fx(1,y,-1);
			add_f(y+1,x,m-x+y);
			add_f(x+1,m,m+y+1);add_fx(x+1,m,-1);
		}
	}
	for (ans=1e18,i=1;i<=m;i++){
		f[i]+=f[i-1];fx[i]+=fx[i-1];
		ans=min(ans,f[i]+(ll)i*fx[i]);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 1280
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val array = Array(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
  println(array(sc.nextInt() - 1))
}


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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
  
  
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int ans=0;
  sort(all(a));
  rep(i,n){
    rep(j,n){
      rep(k,n){
        if(a[i]<a[j]&&a[j]<a[k]){
          if(a[i]+a[j]>a[k]) ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
  
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
  int repeat = 1;
  // cin >> repeat;
  while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp
./a.out

*/

Measured memory_bytes: 7792
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;

class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        long[] dList = ReadLineLongArray();
        long rtn = 0;
        for (int i = 0;i < n; i++) {
            for (int j = i + 1;j < n; j++) {
                rtn += dList[i] * dList[j];
            }
        }
        Console.WriteLine(rtn);
    }

    static string[] ary = new string[] {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}

    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

int main()
{
    int n;
    cin>>n;
    vector<int> a(n*3);
    for(int i=0;i<n*3;i++){
        cin>>a[i];
    }
    sort(rall(a));
    ll count=0;
    for(int i=0;i<2*n;i+=2){
        count+=a[i+1];
    }
    cout<<count<<endl;
    
}

Measured memory_bytes: 1408
from bisect import bisect_left, bisect_right

N,M  = map(int, input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(n//i)
            if i != n // i:
                divisors.append(n//(n//i))

    divisors.sort()
    return divisors


divisors_M = make_divisors(M)

Max = bisect_left(divisors_M,N)
print(M // divisors_M[Max])

Measured memory_bytes: 3188
#include <stdio.h>
 
int main(void){
    int N, A[100005], B[100005], i;
    scanf("%d", &N);
    for (i=1; i<=N; i++) scanf("%d", &A[i]);
    for (i=1; i<=N; i++) B[A[i]]=i;
    for (i=1; i<=N; i++) {
        printf("%d ", B[i]);
    }
    return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>

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

using namespace std;
using ll = long long;

const ll mod = 1000000007;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
// bool debug=false;

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

int h, w, c;

void debug(vector<vector<int>>& p) {
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      cout << p[i][j];
    }
    cout << endl;
  }
}

bool in(int x, int y) {
  return (0 <= x && x < w && 0 <= y && y < h);
}

int count_color(vector<vector<int>>& p) {
  int ret = 0;
  //cout << "======evaluata======" << endl;
  //debug(p);
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      int cnt = 0;
      if(p[i][j] == c) {
	p[i][j] = -1;
	cnt = 1;
	queue<int> que;
	que.push(j), que.push(i);
	while(que.size()) {
	  int x = que.front(); que.pop();
	  int y = que.front(); que.pop();
	  for(int i = 0; i < 4; i++) {
	    int nx = x + dx[i], ny = y + dy[i];
	    if(in(nx, ny) && p[ny][nx] == c) {
	      cnt++;
	      p[ny][nx] = -1;
	      que.push(nx); que.push(ny);
	    }
	  }
	}
      }
      ret = max(ret, cnt);
    }
  }
  //cout << "count: " << ret << endl;
  return ret;
}

vector<vector<int>> paint(vector<vector<int>> p, int _x, int _y, int color) {
  int pos_color = p[_y][_x];
  if(pos_color == color) return p;
  p[_y][_x] = color;
  queue<int> que;
  que.push(_x), que.push(_y);
  // //cerr << "start" << endl;
  while(que.size()) {
    int x = que.front(); que.pop();
    int y = que.front(); que.pop();
    for(int i = 0; i < 4; i++) {
      int nx = x + dx[i], ny = y + dy[i];
      if(in(nx, ny) && p[ny][nx] == pos_color) {
	p[ny][nx] = color;
	que.push(nx); que.push(ny);
      }
    }
  }
  // //cerr << "end" << endl;
  return p;
}

int dfs(vector<vector<int>> p, int cnt) {
  int ret = 0;
  if(cnt == 0) {
    return count_color(p);
  }
  for(int i = 1; i <= 6; i++) {
    vector<vector<int>> new_p = paint(p, 0, 0, i);
    ret = max(ret, dfs(new_p, cnt - 1));
  }
  return ret;
}

void solve() {
  vector<vector<int>> p = vector<vector<int>>(h, vector<int>(w));
  for(int i = 0; i < h; i++) {
    for(int j = 0; j < w; j++) {
      cin >> p[i][j];
    }
  }
  cout << dfs(p, 5) << endl;
}

int main() {
  while(cin >> h >> w >>c) {
    if(h == 0 && w == 0 && c == 0) break;
    solve();
  }
}



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

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  int A,B,C;
  cin >> A >> B >> C;
  if(B+C >= A) cout << (B+C)-A << "\n";
  else cout << "0\n";
  return 0;
}

Measured memory_bytes: 256
N = int(input())
X = [0]*N
Y = [0]*N
for i in range(N):
    X[i],Y[i] = map(int,input().split())

import math
length = 0
for i in range(N-1):
    for j in range(i+1,N):
        length += math.sqrt((X[i]-X[j])**2+(Y[i]-Y[j])**2)

C = N*(N-1)/2

print((N-1)*length/C)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int m[3][3];
    Scd3(m[0][0] , m[0][1] , m[0][2]);
    Scd3(m[1][0] , m[1][1] , m[1][2]);
    Scd3(m[2][0] , m[2][1] , m[2][2]);
    
    bool ans = true;
    Rep(i,2){
        ans = ans && m[0][i] - m[0][i+1]
        == m[1][i] - m[1][i+1] &&
        m[1][i] - m[1][i+1]
        == m[2][i] - m[2][i+1];
        ans = ans && m[i][0] - m[i+1][0]
        == m[i][1] - m[i+1][1] &&
        m[i][1] - m[i+1][1]
        == m[i][2] - m[i+1][2];
    }

    YesNo(ans);


    return 0;
}



Measured memory_bytes: 256