akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solveA(args);
//		solveB(args);
//		solveC(args);
//		solveD(args);
//		solveE(args);
//		solveF(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solveA(String[] args) throws Exception{
		int N= nextInt();
		int X= nextInt();
		int T= nextInt();
		pw.println(((N+X-1)/X)*T);
	}
	public static void solveB(String[] args) throws Exception{

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

	}

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

	}


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

	}

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

	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



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

typedef long long ll;
const ll INF = 1e18;
const int BIG = 1e9 + 555;
const int maxN = 100 * 1000 + 9;
const int MOD = 1e9 + 7;

int n, q;
vector<pair<int, pair<int, int> > > g[maxN];

struct segTree {
	ll sum, cnt;
	int l, r;
	segTree *lCh, *rCh;
}; 

segTree *head[maxN];

segTree *getNode(int l, int r){
	segTree *ans = new segTree;
	ans->l = l, ans->r = r;
	ans->lCh = ans->rCh = NULL;
	ans->sum = ans->cnt = 0;

	return ans;
}

void buildTree0(segTree *id, int l, int r){
	int mid = (l + r) >> 1;
	
	if(l == r){
		return;
	}

	id->lCh = getNode(l, mid);
	id->rCh = getNode(mid + 1, r);

	buildTree0(id->lCh, l, mid);
	buildTree0(id->rCh, mid + 1, r);
}

segTree *upd(segTree *id, int idx, int val){
	int l = id->l, r = id->r, mid = (l + r) >> 1;
	segTree *nw = getNode(l, r);
	nw->lCh = id->lCh;
	nw->rCh = id->rCh;
	nw->sum = id->sum;
	nw->cnt = id->cnt;

	if(idx == l && idx == r){
		nw->sum += val;
		nw->cnt++;
		return nw;
	}

	if(idx <= mid){
		nw->lCh = upd(id->lCh, idx, val);
	} else {
		nw->rCh = upd(id->rCh, idx, val);
	}

	return nw;
}

bool visited[maxN];
int jump[maxN][20], tIn[maxN], tOut[maxN], dfsTime;
ll dist[maxN];

void dfs(int u){
	tIn[u] = ++dfsTime;
	visited[u] = true;

	for(int i = 1; i < 20; i++){
		jump[u][i] = jump[jump[u][i - 1]][i - 1];
	}

	for(int i = 0, L = g[u].size(); i < L; i++){
		int v = g[u][i].first;
		int c = g[u][i].second.first;
		int d = g[u][i].second.second;
		if(visited[v]){
			continue;
		}
		
		head[v] = upd(head[u], c, d);
		jump[v][0] = u;
		dist[v] = dist[u] + (ll)d;
		dfs(v);
	}

	tOut[u] = dfsTime;
}

pair<ll, ll> query(segTree *id, int idx){
	int l = id->l, r = id->r, mid = (l + r) >> 1;
	//cerr << l << ' '  << r << '\n';
	if(l == idx && r == idx){
		return make_pair(id->sum, id->cnt);
	}

	if(idx <= mid){
		return query(id->lCh, idx);
	} else {
		return query(id->rCh, idx);
	}
}

bool isAnc(int u, int v){
	return tIn[u] <= tIn[v] && tOut[u] >= tOut[v];
}

int lca(int u, int v){
	if(isAnc(u, v)){
		return u;
	}

	if(isAnc(v, u)){
		return v;
	}

	for(int i = 19; i >= 0; i--){
		if(!isAnc(jump[u][i], v)){
			u = jump[u][i];
		}
	}

	return jump[u][0];
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n >> q;
	for(int i = 0; i < n - 1; i++){
		int u, v, c, d;  cin >> u >> v >> c >> d;
		g[u].push_back(make_pair(v, make_pair(c, d)));
		g[v].push_back(make_pair(u, make_pair(c, d)));
	}
	
	head[1] = getNode(1, n);
	buildTree0(head[1], 1, n);
	
	jump[1][0] = 1;
	dfs(1);
	
	while(q--){
		ll x, y, u, v;
		cin >> x >> y >> u >> v;
		ll a = lca(u, v);
		//cerr << "lca = " << a << '\n';
		pair<ll, ll> tou = query(head[u], x);	
		pair<ll, ll> tov = query(head[v], x);
		pair<ll, ll> toa = query(head[a], x);


		ll cnt = tou.second + tov.second - (toa.second << 1);
		ll tot = tou.first + tov.first - (toa.first << 1);
		ll du = dist[u] + dist[v] - (dist[a] << 1);
		
		ll ans = du - tot + cnt * y;
		cout << ans << '\n';
	}

	return 0;
}

Measured memory_bytes: 115328
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;
typedef pair<int,int> pr;
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main(){
    ll n; cin >> n;
    string s; cin >> s;
    ll c1 = 0, c2 = 0;
    stack<char> m;

    rep(i,s.length()){
        if(!m.empty()){
            if(m.top() == '(' && s[i] == ')'){
                m.pop();
                continue;
            }
        }
        m.push(s[i]);
    }

    while(!m.empty()){
        if(m.top() == '(') c1 ++;
        else c2 ++;

        m.pop();
    }

    rep(i,c2) cout << '(';
    cout << s;
    rep(i,c1) cout << ')';


}

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

using namespace std;

int main(){

  string sa, sb, sc;

  cin >> sa >> sb >> sc;
  int na = sa.size();
  int nb = sb.size();
  int nc = sc.size();
  int a_count = 0;
  int b_count = 0;
  int c_count = 0;

  string u = "a";

  while ((na != -1) && (nb != -1) && (nc != -1)){

    if (u == "a"){
      u = sa[a_count];
      a_count += 1;
      na -= 1;
    }
    else if (u == "b"){
      u = sb[b_count];
      b_count += 1;
      nb -= 1;
    }
    else {
      u = sc[c_count];
      c_count += 1;
      nc -= 1;
    }

  }

  if (na == -1){
    cout << "A" << endl;
  }
  else if (nb == -1){
    cout << "B" << endl;
  }
  else {
    cout << "C" << endl;
  }

  return 0;
}


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

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int a = scan.nextInt();
        int b = scan.nextInt();
        String ans = "";
        if (0 < a)
            ans = "Positive";
        if (a <= 0 && 0 <= b)
            ans = "Zero";

        if (b < 0 && (b - a) % 2 == 0)
            ans = "Negative";
        if (b < 0 && (b - a) % 2 != 0)
            ans="Positive";

        System.out.println(ans);

    }
}


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

using namespace std;

int main(){
    long long n;
    bool rev = 0;
    deque<long long> ans;
    cin >> n;
    for(long long i = 0; i < n; ++i){
        long long add; cin >> add;
        if(rev == 0)ans.push_back(add);
        else ans.push_front(add);
        rev ^= 1;
    }
    if(!rev){
        while(ans.size() > 0){
            cout << ans.front() << " ";
            ans.pop_front();
        }
    }
    else{
         while(ans.size() > 0){
            cout << ans.back() << " ";
            ans.pop_back();
        }
    }
    return 0;

}


Measured memory_bytes: 3840
n = int(input())
csf = [list(map(int,input().split())) for i in range(n - 1)]
#(c, s, f) = i→i+1へc秒かかる。s秒後に発車し、その後はf秒おきに発車する

ans = [0] * n
for i in range(n - 1):
    temp_time = 0
    for j in range(i, n - 1):
        c, s, f = csf[j]
        if temp_time <= s:
            temp_time += s - temp_time + c

        else:
            temp = temp_time % f
            temp_time += (f - temp) % f + c
    ans[i] = temp_time
print(*ans, sep='\n')

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

int u[128];

int main() {
  string s; cin >> s;
  for (char c : s) u[c] = true;
  for (char c = 'a'; c <= 'z'; c++) if (!u[c]) {
    cout << c << endl;
    return 0;
  }
  cout << "None" << endl;
}

Measured memory_bytes: 512
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}

func breakBrick(bricks []int) (brokenCount int, isSuccess bool) {
	bi := 1
	for _, v := range bricks {
		if bi == v {
			bi++
			continue
		}
		brokenCount++
	}
	if len(bricks) != brokenCount {
		isSuccess = true
	}
	return
}

func main() {
	n := nextInt()
	ints := nextInts(n)
	bc, ok := breakBrick(ints)
	if ok {
		fmt.Println(bc)
	} else {
		fmt.Println(-1)
	}
}


Measured memory_bytes: 3840
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define lb long double
#define vec vector<int>
using namespace std;
int main() {
	int a;
	cin >> a;
	cout << 2 * a * 3.14159265 << endl;
}


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

public static partial class Program
{
    public static void Main()
    {
        var time = new long[5];
        for (int i = 0; i < 5; i++)
        {
            time[i] = CRL().ToInt();
        }

        var diff = new long[5];
        for (int i = 0; i < 5; i++)
        {
            diff[i] = time[i] % 10 == 0 ? 0 : 10 - time[i] % 10;
        }

        long val = 0;
        diff = diff.Sort();
        for (int i = 0; i < 4; i++)
        {
            val += diff[i] + time[i];
        }

        val += time[4];
        CWL(val);
    }
}

public static partial class Program
{
    //テンプレここから
    private static long ToInt(this string str) => long.Parse(str);
    private static long[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static long[] dx = new long[] { 0, -1, 0, 1 };
    public static long[] dy = new long[] { -1, 0, 1, 0 };
    public static long mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array)
    {
        var list = array.ToList();
        list.Sort();
        return list.ToArray();
    }
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    //テンプレここまで
}


Measured memory_bytes: 13268
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    int k;
    string s;
    cin>> k >> s;
    vector<char> v;
    if(k>=s.length()){
        cout << s << endl;
    }
    else{
        v.assign(s.begin(),s.begin()+k);
        v.push_back('.');
        v.push_back('.');
        v.push_back('.');
        printf("%s\n",&v[0]);
    }
    return 0;
}


Measured memory_bytes: 3628
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		ArrayList<Integer> list = new ArrayList<>();

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for (int i = 0; i < n; i++) {
			int l = sc.nextInt();
			list.add(l);
		}
		sc.close();

		int count = 0;

		for (int i = 0; i < list.size(); i++) {
			for (int j = i + 1; j < list.size(); j++) {
				for (int k = j + 1; k < list.size(); k++) {
					int first = list.get(i);
					int second = list.get(j);
					int third = list.get(k);
					if (first == second || second == third || third == first) {
						continue;
					}
					if (isTriangle(list.get(i), list.get(j), list.get(k))) {
						count++;
					}
				}
			}
		}
		print(count);
	}

	public static boolean isTriangle(int i, int j, int k) {
		int max = Math.max(i, j);
		max = Math.max(max, k);
		if (i + j + k - max > max) {
			return true;
		}
		return false;
	}

	public static void print(Object obj) {
		System.out.println(obj);
	}

}


Measured memory_bytes: 37492
MOD = 10**9+7

n = int(input())
a = list(map(int,input().split()))
asum = []
tmp = sum(a)
for i in a:
    tmp -= i
    asum.append(tmp)

ans = 0
for i in range(n):
    ans += a[i]*asum[i] % MOD
print(ans % MOD)

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

typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int k,u;
    int v;
    int table[200][200]={};
    for(int i=0;i<n;i++){
        cin >> u;
        cin >> k;
        for(int j=0;j<k;j++){
            cin >> v;
            table[u-1][v-1]=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(j)cout << " ";
            cout << table[i][j];
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3356
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define FOR(a,b) for(int a=0;a<b;a++)
using namespace std;
using ll=long long;
static const int MAX = 100;
static const ll INF = (1LL << 32);
int n;
ll d[MAX][MAX];

void floyd() {
	FOR(k, n) {
		FOR(i, n) {
			if (d[i][k] == INF) continue;
			FOR(j, n) {
				if (d[k][j] == INF) continue;
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

int main() {
	int e, s, t, w;
	cin >> n >> e;
	FOR(i, n) {
		FOR(j, n) {
			d[i][j] = (i == j) ? 0 : INF;
		}
	}
	FOR(i, e) {
		cin >> s >> t >> w;
		d[s][t] = w;
	}
	floyd();
	bool neg;
	FOR(i, n) {
		if (d[i][i] < 0) {
			neg = 1;
			cout << "NEGATIVE CYCLE" << endl;
			return 0;
		}
	}
	FOR(i, n) {
		FOR(j, n) {
			if (j > 0) cout << ' ';
			if (d[i][j] == INF) cout << "INF";
			else cout << d[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 2e9;
char t[] = {'P', 'D'};
int main(){ 
  string s;
  cin >> s;
  int n = s.size();
  vector<vector<int>> dp(n + 1, vector<int>(2, 0));
  vector<vector<int>> prev(n + 1, vector<int>(2, -1));
  map<char, int> id;
  id['P'] = 0;
  id['D'] = 1;
  id['?'] = 2;
  for (int i = 0; i < n; i++) {
    int k = id[s[i]];
    for (int j = 0; j < 2; j++) {
      if (k == 1) {
        if (dp[i + 1][k] < dp[i][j] + (j == 0 ? 2 : 1)) {
          dp[i + 1][k] = dp[i][j] + (j == 0 ? 2 : 1);
          prev[i + 1][k] = j;
        }
      }
      if (k == 0) {
        if (dp[i + 1][k] < dp[i][j]) {
          dp[i + 1][k] = dp[i][j];
          prev[i + 1][k] = j;
        }
      }
      if (k == 2) {
        if (dp[i + 1][1] < dp[i][j] + (j == 0 ? 2 : 1)) {
          dp[i + 1][1] = dp[i][j] + (j == 0 ? 2 : 1);
          prev[i + 1][1] = j;
        }
        if (dp[i + 1][0] < dp[i][j]) {
          dp[i + 1][0] = dp[i][j];
          prev[i + 1][0] = j;
        }
      }
    }
  }
  string res = "";
  int now = 0;
  int j = -1;
  for (int i = 0; i < 2; i++) {
    if (now < dp[n][i]) {
      now = dp[n][i];
      j = i; 
    }
  }

  int i = n;

  while (i) {
    res += t[j];
    j = prev[i][j];
    i--;
  }

  reverse(res.begin(), res.end());
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 25780
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.IO;
using System.Text;
using N = System.Int32;

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

public class Solver
{
    public void Solve()
    {
        N d = rn, t = rn, s = rn;
        Yn(d <= t * s);
    }

    N rn { get { return sc.Integer(); } }
    double rd { get { return sc.Double(); } }
    string rs { get { return sc.Scan(); } }
    public StreamScanner sc = new StreamScanner(Console.OpenStandardInput());

    void Write<T>(T t) { Console.WriteLine(t.ToString()); }
    void YN(bool t) { Console.WriteLine(t ? "YES" : "NO"); }
    void Yn(bool t) { Console.WriteLine(t ? "Yes" : "No"); }
    void yn(bool t) { Console.WriteLine(t ? "yes" : "no"); }
}



public class StreamScanner
{
    public StreamScanner(Stream stream) { str = stream; }
    private readonly Stream str;
    private readonly byte[] buf = new byte[1024];
    private int len, ptr;
    public bool isEof = false;
    public bool IsEndOfStream { get { return isEof; } }
    private byte read()
    {
        if (isEof) throw new EndOfStreamException();
        if (ptr >= len)
        {
            ptr = 0;
            if ((len = str.Read(buf, 0, 1024)) <= 0)
            {
                isEof = true;
                return 0;
            }
        }
        return buf[ptr++];
    }
    public char Char()
    {
        byte b = 0;
        do b = read();
        while (b < 33 || 126 < b);
        return (char)b;
    }
    public string Scan()
    {
        var sb = new StringBuilder();
        for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
            sb.Append(b);
        return sb.ToString();
    }
    public N Integer()
    {
        N ret = 0; byte b = 0; var ng = false;
        do b = read();
        while (b != '-' && (b < '0' || '9' < b));
        if (b == '-') { ng = true; b = read(); }
        for (; true; b = read())
        {
            if (b < '0' || '9' < b)
                return ng ? -ret : ret;
            else ret = ret * 10 + b - '0';
        }
    }
    public double Double() { return double.Parse(Scan()); }
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;

#define rep(i, n) for(int i=0;i<(int)n;i++)
#define rep2(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N=1e5;
  vector<bool> is_prime(N+1,true);
  is_prime[0]=false;is_prime[1]=false;
  for(int i=2;i*i<=N;i++) {
    if(!is_prime[i]) continue;
    for(int j=2; i*j<=N; j++) is_prime[i*j]=false;
  }
  vi sum(N+1);
  rep(i,N) {
    sum[i+1]=sum[i];
    if(!(i%2)&&is_prime[i+1]&&is_prime[i/2+1]) sum[i+1]++;
  }
  
  int Q;
  cin >> Q;
  vi l(Q),r(Q);
  rep(i,Q) {
    cin >> l[i] >> r[i];
    cout << sum[r[i]]-sum[l[i]-1] << endl;
  }
}

Measured memory_bytes: 1792
import sys,queue,math,copy,itertools,bisect,collections
from heapq import *

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N,M = LI()
    root =[[] for _ in range(N+1)]
    for _ in range(M):
        a,b = LI()
        root[a].append(b)
        root[b].append(a)

    node = [INF] * (N+1)
    ans = [-1] * (N+1)

    q = [(0,1,-1)]
    heapify(q)
    node[1] = 0

    while q:
        d,v,f = heappop(q)
        node[v] = d
        ans[v] = f
        for u in root[v]:
            if node[u] <= d+1: continue
            node[u] = d+1
            heappush(q,(d+1,u,v))

    print('Yes')
    print(*ans[2:],sep='\n')

if __name__ == '__main__':
    main()

Measured memory_bytes: 108080
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long
#define pb push_back
int max_num = pow(10, 5)*2;

int main() {
  int N;
  cin >> N;
  vector<ll> a(N);
  vector<ll> b(max_num, 0);
  vector<ll> c(max_num);

  rep(i, N){
    cin >> a[i];
    b[a[i]-1]++;
  }

  ll tmp = 0;
  ll sum = 0;
  rep(i, N){
    if (b[i] <= 1){
      c[i] = 0;
    } else if (b[i] == 2){
      c[i] = 1;
    } else {
      c[i] = b[i] * (b[i]-1)/2;
    }
    // cout << b[i] << " " << c[i] << endl;
    sum += c[i];
  }

  ll ans = 0;
  ll j;
  rep(i, N){
    j = a[i] - 1;
    ans = - c[j];
    tmp = b[j] - 1;
    if (tmp <= 1){
      ans += 0;
    } else if (tmp == 2){
      ans += 1;
    } else {
      ans += tmp * (tmp-1)/2;
    }
    cout << ans + sum << endl;
  }
  
}


Measured memory_bytes: 7296
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

class dijkstra{
  constructor(n){
    this.graph = Array(n).fill().map(a=>[]);
  }
  add(u,v,cost){
    this.graph[u].push(v,cost);
  }
  add2(u,v,cost){
    this.graph[u].push(v,cost);
    this.graph[v].push(u,cost);
  }
  solve(start){
    const INF = 1e18;
    const g = this.graph, pq = new priorityQueue(), dp = Array(g.length).fill(INF);
    pq.push(0,start);
    dp[start] = 0;
    while(pq.size){
      const [t,v] = pq.pop();
      if(dp[v] < t)continue;
      for(var i = 0; i < g[v].length; i+=2){
        const V = g[v][i], c = g[v][i+1] + t;
        if(dp[V] <= c)continue;
        dp[V] = c;
        pq.push(c,V);
      }
    }
    return dp;
  }
}

class priorityQueue{
  constructor(){
    this.a=[];
  }
  push(num,inc){
    const a = this.a;
    for(var i = a.length, j; i; i = j){
      j = i - 1 >> 1;
      if(a[j][0] <= num)break;
      a[i] = a[j];
    }
    a[i] = [num,inc];
  }
  pop(){
    const a = this.a, r = a[0], x = a.pop(), k = a.length >> 1;
    for(var i = 0, j; i < k; i = j){
      j = (i << 1) + 1;
      if(a[j+1] && a[j+1][0] < a[j][0])j++;
      if(x[0] <= a[j][0])break;
      a[i] = a[j];
    }
    if(a.length)a[i] = x;
    return r;
  }
  get size(){
    return this.a.length;
  }
  get top(){
    return this.a[0];
  }
}

const mx = 2500;

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var [n,m,s] = nexts(3);
  var g = new dijkstra(mx * n);
  for(var i = 0; i < m; i++){
    var [u,v,a,b] = nexts(4);
    u--,v--;
    u *= mx, v *= mx;
    for(var j = mx; j-- > a;){
      g.add(u+j,v+j-a,b);
      g.add(v+j,u+j-a,b);
    }
  }
  for(var i = 0; i < n; i++){
    var [c,d] = nexts(2);
    var v = i * mx;
    for(var j = 0; j < mx-1; j++)g.add(v+j,v+Math.min(mx-1,j+c),d);
  }
  var dp = g.solve(Math.min(mx-1,s));
  var ans = xArray(1e18,n);
  for(var i = 1; i < n; i++){
    var v = i*mx;
    for(var j = 0; j < mx; j++){
      ans[i] = Math.min(ans[i],dp[v+j]);
    }
  }
  return ans.slice(1).join("\n");
}

Measured memory_bytes: 112152
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
using namespace std;

int garden(vector<int> &h,int n,int j,int i){
    if(j==n-1&&h[j]==i){
        h[j]-=1;
        return 0;
    }
    if(h[j]==i){
        h[j]-=1;
        garden(h,n,j+1,i);
    }
    if(h[j]!=i){
        return 0;
    } 
}

int main(){
    ios::sync_with_stdio(false);
    int n,count=0;
    cin >> n;
    vector<int>h(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    int max=*max_element(h.begin(),h.end());
    for(int i=max;i>0;i--){
        for(int j=0;j<n;j++){
            if(h[j]==i){
                garden(h,n,j,i);
                count++;
            }   
        }
    }
    cout << count;
}

Measured memory_bytes: 256
from math import atan, pi
a, b, x = map(int, input().split())

if x > a * a * b / 2:
    h = 2 * x / (a * a) - b
    ans = atan((b - h) / a)
else:
    h = 2 * x / (a * b)
    ans = pi / 2 - atan(h/b)

ans *= 180 / pi
print("{:.12f}".format(ans))

Measured memory_bytes: 62436
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e18)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}

template <typename T> 
ostream& operator<<(ostream& os, const vector<T>& v) 
{ 
    for (int i = 0; i < (int)v.size(); ++i) { 
        os << v[i]; 
        if (i != (int)v.size() - 1) 
            os << " "; 
    } 
    return os; 
} 

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<pair<ll, P>> v(M);
    rep(i, M){
        ll a, b, c;
        cin >> a >> b >> c;
        a--;b--;c = -c;
        v[i] = pair<ll, P>(a, make_pair(b, c));
    }
    vector<ll> d(N, INF);
    d[0] = 0;
    rep(i, N) {
        rep(j, M) {
            if (d[v[j].second.first] > d[v[j].first] + v[j].second.second) {
                d[v[j].second.first] = d[v[j].first] + v[j].second.second;
                if (i == N-1 && v[j].second.first == N-1) {
                    print("inf");
                    return 0;
                }
            }
        }
    }
    print(-d[N-1]);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

int H, W, N;
int a[100005];
int b[100005];

map< pair<int,int>, int> pos;
map< pair<int,int>, int> memo;
int lp[5][5];

int main(){
  ios::sync_with_stdio(false);
  cin >> H >> W >> N;
  rep(i,N){
    cin >> a[i] >> b[i];
    pos[make_pair(a[i],b[i])] = 1;
  }
  
  rep(i,N){
    int y = a[i];
    int x = b[i];
    for(int ii=-2; ii<=2; ii++){
      for(int jj=-2; jj<=2; jj++){
        int ny = y + ii;
        int nx = x + jj;
        if(1<=nx && nx<=W && 1<=ny && ny<=H){
          if(pos.count(make_pair(ny,nx))>0) lp[ii+2][jj+2] = 1;
          else lp[ii+2][jj+2] = 0;
        }else{
          lp[ii+2][jj+2] = -1;
        }
      }
    }

    for(int ii=0; ii<3; ii++){
      for(int jj=0; jj<3; jj++){
        int cnt = 0;
        rep(yy,3){
          rep(xx,3){
            if(cnt < 0) continue;
            if(lp[ii+yy][jj+xx]==1) cnt++;
            if(lp[ii+yy][jj+xx]==-1) cnt = -1;
          }
        }
        if(cnt >= 0){
          memo[make_pair(y+ii-2,x+jj-2)] = cnt;
        }
      }
    }
  }

  vector<ll> ret(10,0);
  ll allcnt = 0;
  FOR(it,memo){
    ret[it->second]++;
    allcnt++;
  }
  ret[0] = ((H-2)*(ll)(W-2)) - allcnt;

  rep(i,10){
    cout << ret[i] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 63488
#include <iostream>
using namespace std;
int main(void){
    
    
    //変数：Ａ君がもらった金額 「 a 」、Ｂ君がもらった金額 「 b 」と置く
    int a, b;
    
    //入力：Ａ君がもらった金額 「 a 」、Ｂ君がもらった金額 「 b 」を入力する
    cin >> a >> b;
    
    //出力：Ａ君とＢ君の平均値求める
    cout << (a + b)/2 << endl;
    
    
    return 0;
}



Measured memory_bytes: 3092
import collections

N = int(input())

xy = []
for i in range(N):
    xy.append(list(map(int, input().split())))

if N >= 2:
    relations = []
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            else:
                relations.append((xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]))
    
    relations = collections.Counter(relations)
    most_common = relations.most_common()[0][1]
    print(N-most_common)
else:
    print(1)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d;cin >> a >> b >> c >> d;
	cout << max(a * b, c * d) << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
        int target = Integer.parseInt("" + a + b);
       
        String ans = "";
        int value = 1;
        while(true) {
          int i = value * value;
          if (i == target) {
            ans = "Yes";
            break;
          } else if (i > target) {
            ans = "No";
            break;
          }
          value++;
        }
    
		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, K, R, S, P, ans = 0;
    string T;
    cin >> N >> K >> R >> S >> P >> T;
 
    for (int i = 0; i < N; ++i) {
        if (i >= K && T[i] == T[i - K]) T[i] = 'o';
        if (T[i] == 'r') ans += P;
        else if (T[i] == 's') ans += R;
        else if (T[i] == 'p') ans += S;
    }
 
    cout << ans << endl;
    
    return 0;
}


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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int N; cin >> N;
    vector<int> p( N );
    REP( i, N ) cin >> p[i];

    int cnt = 0;
    REP( i, N - 2 ){
        if( p[i] < p[i + 1] && p[i + 1] < p[i + 2] || p[i + 2] < p[i + 1] && p[i + 1] < p[i] ){
            cnt++;
        }
    }

    cout << cnt << endl;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  LL n;
  cin >> n;
  for(LL i=1;i<=n+1;i++){
    if(i*(i-1)/2==n){
      cout << "Yes" << endl;
      cout << i << endl;
      vector<list<int>> e(i);
      int count=1;
      for(int j=0;j<i;j++){
        for(int k=j+1;k<i;k++){
          e[j].push_back(count);
          e[k].push_back(count);
          count++;
        }
      }
      for(int j=0;j<i;j++){
        cout << e[j].size() << " ";
        count=0;
        auto it=e[j].begin();
        for(;count<e[j].size()-1;count++,it++){
          cout << (*it) << " ";
        }
        cout << (*it);
        cout << endl;
      }
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 7680
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<utility>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(int i=0;i<j;i++)
#define rep1(i,j) for(int i=1;i<=j;i++)
#define rep0d(i,j) for(int i=j-1;i>=0;i--)
#define MAX 1000000007

using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int > vec(n+1,0),ans(n-1);
	rep1(i, n) {
		int k;
		cin >> k;
		vec[i] = k + vec[i - 1];
	}
	rep0(i, n-1)ans[i] = abs(2*vec[i+1] - vec[n]);

	sort(all(ans));
	cout << ans[0];

	
}


Measured memory_bytes: 256
N = int(input())
dist = [0] #dist[i]は0からiまでのコスト
A = list(map(int,input().split()))
A.insert(0, 0)
for i in range(N):
    dist.append(dist[i] + abs(A[i] - A[i+1]))

upplim = N-1
for i in range(upplim):
    print(str(dist[i] + abs(A[i+2] - A[i]) + dist[N] - dist[i+2] + abs(A[N])))
print(str(dist[N-1] + abs(A[N-1])))


Measured memory_bytes: 14044
// D - Make Them Even

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;


struct Cell {
	int y;
	int x;
	int c;
};

struct Move {
	int y1;
	int x1;
	int y2;
	int x2;
};

int field[500][500];
Cell cells[500 * 500];

int main() {
	int H, W;
	cin >> H >> W;

	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			cin >> field[i][j];
		}
	}

	int k = 0;
	for (int i=0; i<H; i++) {
		if (i % 2 == 0) {
			for (int j=0; j<W; j++) {
				cells[k] = {i, j, field[i][j]};
				k++;
			}
		} else {
			for (int j=W-1; j>=0; j--) {
				cells[k] = {i, j, field[i][j]};
				k++;
			}
		}
	}

	int N = 0;
	vector<Move> ans;
	for (int i=0; i<H*W-1; i++) {
		if (cells[i].c % 2 == 1) {
			ans.push_back(Move{cells[i].y, cells[i].x, cells[i+1].y, cells[i+1].x});
			cells[i+1].c++;
			N++;
		}
	}

	cout << N << endl;
	for (Move a : ans) {
		cout << a.y1 + 1 << " " << a.x1 + 1 << " " << a.y2 + 1 << " " << a.x2 + 1 << endl;
	}

	return 0;
}

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

int main()
{
	string s;
	int n;
	while (getline(cin, s))
	{
		n = s.size();
		for (int i = 1; i < 27; i++)
		{
			for (int j = 0; j < n; j++)
			{
				if (s[j] == ' ' || s[j] == '.')
				{
					continue;
				}
				if (s[j] == 'z')
				{
					s[j] = 'a';
					continue;
				}
				s[j] ++;

			}
			

			bool ba = s.find("the") != string::npos;
			bool bb = s.find("this") != string::npos;
			bool bc = s.find("that") != string::npos;
			if (ba || bb || bc)
			{
				cout << s << endl;
			}
			
		}
	}

	return 0;
}


Measured memory_bytes: 2996
#include<bits/stdc++.h>
using namespace std;
#define int int64_t 
const int INF = 1e9;
const int MOD = INF+7;
const int LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb(n) push_back(n)

int N,A,B,C;
vector<int> L;
int dfs(int cnt,int a,int b,int c){
    if(cnt == N) return abs(a - A) + abs(b - B) + abs(c - C) - (min({a,b,c}) > 0 ? 30 : -INF);

    int non = dfs(cnt+1, a, b, c); 
    int use_A = dfs(cnt+1, a+L[cnt], b, c) + 10;
    int use_B = dfs(cnt+1, a, b+L[cnt], c) + 10;
    int use_C = dfs(cnt+1, a, b, c+L[cnt]) + 10;
    return min({non,use_A,use_B,use_C});
}

signed main(){
    cin >> N >> A >> B >> C;
    L.resize(N);
    rep(i,N) cin >> L[i];
    cout << dfs(0,0,0,0) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
	int a;
    cin >> a;
  	cout << a * (a + 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

const int MAX_BIT = 40;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<int> cnt;
    ll x = 0, ans = 0;
    int top = 0;
    
    rep(i, n) {
        cin >> a[i];
    }
    
    while((1LL << top) <= k) {
        top++;
    }
    
    cnt.resize(top, 0);
    
    rep(i, top) {
        ll cb = (1LL << i);
        
        rep(ii, n) {
            if ((a[ii] & cb) == 0) {
                cnt[i]++;
            }
        }
    }
    
    rrep(i, top) {
        bool f = true;
        
        if ((cnt[i] * 2) < n) {
            f = false;
        }
        else if ((i > 0) && ((cnt[i] * 2) < cnt[i - 1])) {
            f = false;
        }
        
        if ((f) && (k >= (x | (1LL << i)))) {
            x |= 1LL << i;
        }
    }
    
    rep(i, n) {
        ans += x ^ a[i];
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

template <typename T>
vector<T> dijkstra(int s, vector<vector<pair<int, T>>> &G) {
    const T inf = numeric_limits<T>::max();
    using P     = pair<T, int>;
    int n       = G.size();
    vector<T> d(n, inf);
    priority_queue<P, vector<P>, greater<P>> q;
    d[s] = 0;
    q.emplace(d[s], s);
    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        for (auto &e : G[v]) {
            int u = e.first;
            T c   = e.second;
            if (d[u] > d[v] + c) {
                d[u] = d[v] + c;
                q.emplace(d[u], u);
            }
        }
    }
    return d;
}

template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s--, t--;
    vector<vector<pair<int, lint>>> edgesy(n), edgess(n);
    for (int i = 0; i < m; ++i) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--, v--;
        edgesy[u].emplace_back(v, a);
        edgess[u].emplace_back(v, b);
        edgesy[v].emplace_back(u, a);
        edgess[v].emplace_back(u, b);
    }
    auto disty = dijkstra(s, edgesy);
    auto dists = dijkstra(t, edgess);
    lint init  = 1000000000000000;
    lint r     = 0;
    deque<lint> ret;
    for (int i = n - 1; i >= 0; --i) {
        chmax(r, init - disty[i] - dists[i]);
        ret.push_front(r);
    }
    for (auto &r : ret) {
        cout << r << "\n";
    }
    return 0;
}

Measured memory_bytes: 19072
import itertools
x=[0.]*100;y=[0.]*100
while 1:
    n=int(input())
    if n==0:break
    a=0
    for i in range(n):x[i],y[i]=map(float,input().split(','))
    for i,j in itertools.product(range(100),range(100)):
            c=0
            for k in range(n):
                if pow(x[k]-(i/10),2)+pow(y[k]-(j/10),2)<=1.01:c+=1
            if c>a:a=c
    print(a)

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

int main()
{
    int n,d;cin>>n>>d;
    vector<vector<int>> x(n, vector<int> (d));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            cin>>x[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < n - 1; i++){
        for(int j = i + 1; j < n; j++){
            int sum = 0;
            for(int k = 0; k < d; k++){
                sum += (x[i][k] - x[j][k])*(x[i][k] - x[j][k]);       
            }
            for(int k = 1; k <= 126; k++){
                if(sum == k*k) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector<vector<int>> A(2,vector<int>(N));
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < N; j++) cin >> A[i][j];
            
    }
    vector<int> U(N+1),S(N+1);
    for(int i = 0; i < N; i++){
        U[i+1] += U[i] + A[0][i];
        S[i+1] += S[i] + A[1][i];
    }
    int ans = 0;
    for(int i = 0; i < N; i++){
        int now = U[i+1] + S[N] - S[i];
        ans = max(ans,now);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    map<ll,ll> a;
    rep(i,n){
      ll m;
      cin>>m;
      a[m]++;
    }
    ll ans=0;
    for(auto itr:a){
      if(itr.first!=itr.second){
        if(itr.first<itr.second){
          ans+=-itr.first+itr.second;
        }else{
          ans+=itr.second;
        }
      }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6272
while True:
    a,op,b=map(str,input().split())
    if  op=="?":
        break
    else:
        if op=="+":
            print(int(a)+int(b))
        elif op=="-":
            print(int(a)-int(b))
        elif op=="*":
            print(int(a)*int(b))
        else:
            print(int(a)//int(b))


Measured memory_bytes: 5596
(let* ((n (read))
       (m (read)))
  (defun seki-p (m d)
    (let* ((d10 (floor d 10))
           (d1 (mod d 10)))
      (and (<= 2 d1) (<= 2 d10) (= m (* d1 d10)))))
  (princ (loop :for t-month :from 1 :upto n
        :sum(loop :for t-day :from 1 :upto m :count(seki-p t-month t-day)))))

Measured memory_bytes: 15840
A = str(input(''))
if A == 'a':
  print('b')
elif A == 'b':
  print('c')
elif A == 'c':
  print('d')
elif A == 'd':
  print('e')
elif A == 'e':
  print('f')
elif A == 'f':
  print('g')
elif A == 'g':
  print('h')
elif A == 'h':
  print('i')
elif A == 'i':
  print('j')
elif A == 'j':
  print('k')
elif A == 'k':
  print('l')
elif A == 'l':
  print('m')
elif A == 'm':
  print('n')
elif A == 'n':
  print('o')
elif A == 'o':
  print('p')
elif A == 'p':
  print('q')
elif A == 'q':
  print('r')
elif A == 'r':
  print('s')
elif A == 's':
  print('t')
elif A == 't':
  print('u')
elif A == 'u':
  print('v')
elif A == 'v':
  print('w')
elif A == 'w':
  print('x')
elif A == 'x':
  print('y')
else:
  print('z')



Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <functional>
#include <set>
#include <iterator>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

/* Union-find
int par[100010];
int trank[100010];

void init(int n) {
   for (int i=0;i<n;i++) {
      par[i] = i;
      trank[i] = 0;
   }
}
int find(int x) {
   if (par[x] == x) {
      return x;
   } else {
      return par[x] = find(par[x]);
   }
}
void unite(int x, int y) {
   x = find(x);
   y = find(y);
   if (x == y) return;
   if (trank[x] < trank[y]) {
      par[x] = y;
   } else {
      par[y] = x;
      if (trank[x] == trank[y]) trank[x]++;
   }
}
bool same(int x, int y) {
   return find(x) == find(y);
}
*/


string s;
int K;
string smallest[6];
ll dp[6];
int coun = 1;
set<string> a;

ll calc_VAL(const string s) {
   ll val = 0;
   for (int i=0;i<(int)s.size();i++) {
      val += (s[i] - 96) * pow(1000, 4-i);
   }
   return val;
}

int main() {
   cin >> s;
   cin >> K;
   for (int i=0;i<s.length();i++) {
      for (int j=1;j<=K;j++) {
         if (i+j > s.length()) {
            break;
         }
         string substr = s.substr(i, j);
         a.insert(substr);
      }

   }
   vector<string> b(a.begin(), a.end());
   cout << b[K-1] << endl;
}

Measured memory_bytes: 1792
a = int(input())
b = list(map(int,input().split()))
c = []
for val in range(a):
    c.append(5)
for val in range(a):
    c[b[val]-1] = val+1
d = str()
for val in range(len(c)-1):
    print(c[val], end = ' ')
print(c[-1])

Measured memory_bytes: 13880
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.length() + 1;
    //左に<が何個あるか、右に>が何個あるか
    vector<int> left(n), right(n);
    // left
    left[0] = 0;
    for (int i = 1; i < n; i++) {
        if (s[i - 1] == '<') {
            left[i] = left[i - 1] + 1;
        } else {
            left[i] = 0;
        }
    }
    // right
    right[n - 1] = 0;
    for (int i = n - 2; i >= 0; i--) {
        if (s[i] == '>') {
            right[i] = right[i + 1] + 1;
        } else {
            right[i] = 0;
        }
    }
    lint a = 0;
    for (int i = 0; i < n; i++) {
        a += max(left[i], right[i]);
    }
    cout << a << endl;
}

Measured memory_bytes: 4740
use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::cmp::*;
use std::collections::HashSet;
use std::iter::Iterator;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
    mut s: String,
    }

    println!("{}", &s[0..3]);
}


Measured memory_bytes: 2064
#include<cstdio>
#include<algorithm>
#include<cmath> 
#include<iostream>
using namespace std;
int a[10005];
int n,ans;
int main(){
	ans=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
    for(int i=0;i<n;i++){
	    for(int j=2;j<=sqrt(a[i]);j++){
            if(a[i]%j == 0){
            ans++;
            break;
        }
    }
}
    printf("%d\n",n-ans);
	return 0;
	}


Measured memory_bytes: 3248
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl

const int MOD = 1000000007;

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

  int N,K; cin>>N>>K;

  ll res = K;
  rep(i,N-1)res*=K-1;
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    K = int(readline())

    print((K // 2) * ((K + 1) // 2))

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9104