akhauriyash/Code-Regression huggingface dataset:
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	set := make(map[int]int)
	for i := 0; i < N; i++ {
		a := sc.nextInt()
		set[a]++
		set[a-1]++
		set[a+1]++
	}
	ans := 0
	for _, count := range set {
		if ans < count {
			ans = count
		}
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FASTIO ios::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())

int main() {
	FASTIO;
	string n;
	cin >> n;
	int sum = 0;
	for(auto a : n) {
	    sum += a - 48;
	}
	cout << (sum % 9 ? "No\n" : "Yes\n");
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
map<vector<int>, int> memo[2];
int main(void){
    int n; cin >> n;

    vector<int> a(n);
    for(auto & e : a) cin >> e;

    int nn = (n - 1) / 2;

    int res = n - 1;
    rep(i, 2){
        queue<vector<int>> q;
        q.push(a);
        memo[i][a] = 0;

        while(q.size()){
            vector<int> b;
            b = q.front(); q.pop();

            if(i == 1 and memo[0].find(b) != end(memo[0])){
                res = min(res, memo[0][b] + memo[1][b]);
                continue;
            }

            if(memo[i][b] >= nn) continue;

            rep(j, n){
                range(k, j + 1, n){
                    vector<int> nb = b;
                    reverse(begin(nb) + j, begin(nb) + k + 1);

                    if(memo[i].find(nb) != end(memo[i])) continue;

                    memo[i][nb] = memo[i][b] + 1;
                    q.push(nb);
                }
            }
        }

        sort(begin(a), end(a));
    }

    cout << res << endl;

	return 0;
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}


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

  int n, m;
  cin >> n >> m;
  ll k;
  cin >> k;
  vector<ll> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];

  vector<ll> asum(n+1), bsum(m+1);

  asum[0] = 0;
  bsum[0] = 0;
  rep(i, n) asum[i+1] = asum[i] + a[i];
  rep(i, m) bsum[i+1] = bsum[i] + b[i];

  int ans = 0;
  rep(i, n+1){

    // Aからi本読む
    ll tmp_a = asum[i];
    ll res = k - tmp_a;
    if(res < 0) continue;

    int ind = upper_bound(bsum.begin(), bsum.end(), res) - bsum.begin();

    chmax(ans, i + ind - 1);


  }

  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 9512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   string S;
   cin >> S;
   if (S == "SSS") {cout << 0 << endl;}
   else if (S == "SSR") {cout << 1 << endl;}
   else if (S == "RSS") {cout << 1 << endl;} 
   else if (S == "SRS") {cout << 1 << endl;}
   else if (S == "SRR") {cout << 2 << endl;}
   else if (S == "RSR") {cout << 1 << endl;}
   else if (S == "RRS") {cout << 2 << endl;}
   else if (S == "RRR") {cout << 3 << endl;}
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int& ai : a) {
    cin >> ai;
  }

  int all = 0;
  for (int ai : a) {
    all ^= ai;
  }

  for (int i = 0; i < N; ++i) {
    int ret = a[i] ^ all;
    cout << ret;
    if (i != N - 1)
      cout << " ";
    else
      cout << endl;
  }

  return 0;
}


Measured memory_bytes: 3916
#include<cstdio>
long long num[100],n,t=2;
int main()
{
	num[0]=2,num[1]=1;
    scanf("%lld",&n);
    for(;t<=n;t++)
    {
        num[t]=num[t-1]+num[t-2];
	}
	printf("%lld",num[n]);
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int n, minx;
int x[100000];

void palind() {
	for (int i = 0; i < 100000; i++) {
		if (i < 10) { x[i] = 1; }
		else if (i >= 10 && i < 100 && i % 11 == 0) { x[i] = 1; }
		else if (i >= 100 && i < 1000 && i / 100 == i % 10) { x[i] = 1; }
		else if (i >= 1000 && i < 10000 && i / 1000 == i % 10 && i % 11 == 0) { x[i] = 1; }
		else if (i >= 10000 && i / 10000 == i % 10 && (i / 1000) % 10 == (i / 10) % 10) { x[i] = 1; }
	}
}

int main() {
	palind();
	cin >> n;
	for (int i = n; i >= 0; i--) {
		if (x[i] == 1) { minx = i; break; }
	}
	for (int i = n; i < 100000; i++) {
		if (x[i] == 1) {
			if (n - minx > i - n) { minx = i; }; break;
		}
	}
	cout << minx << endl;
	return 0;
}

Measured memory_bytes: 1548
n = int(input())
ppp = list(map(int, input().split()))

n_satisfy_cond = 0
for i in range(1, n - 1):
    p_im1 = ppp[i - 1]
    p_i = ppp[i]
    p_ip1 = ppp[i + 1]
    if p_im1 < p_i < p_ip1:
        n_satisfy_cond += 1
    elif p_ip1 < p_i < p_im1:
        n_satisfy_cond += 1

print(n_satisfy_cond)

Measured memory_bytes: 3060
/**
* File: main.cpp
* Author: Tatsuro Ide
* Date: 2/7/2017
* Desc: Competitive Programming AOJ 0567
*/

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int number_of_toppings, crust_price, topping_price, crust_calories;
	vector<int> topping_calories;

	// get inputs.
	cin >> number_of_toppings;
	cin >> crust_price;
	cin >> topping_price;
	cin >> crust_calories;

	// allocate memory.
	topping_calories.resize(number_of_toppings);

	// store the toppings' calories.
	for (int i = 0; i < number_of_toppings; ++i)
	{
		cin >> topping_calories[i];
	}

	// sort the calories (descending order).
	sort(topping_calories.begin(), topping_calories.end(), greater<int>());

	// vars
	int total_calories = crust_calories;
	int total_price = crust_price;
	int calories_per_dollar = 0;

	for (int i = 0; i < number_of_toppings; ++i)
	{
		// update calories and price.
		total_calories += topping_calories.at(i);
		total_price += topping_price;

		// if the previous calories_per_dollar is greater than new one,
		// quit the search. Otherwise, update it.
		if (calories_per_dollar > (total_calories / total_price))
		{
			break;
		}
		else
		{
			calories_per_dollar = total_calories / total_price;
		}
	}

	// print out the result.
	cout << calories_per_dollar << endl;
	
	return 0;
}

Measured memory_bytes: 3148
#include<iostream>
#include<vector>
using namespace std;
typedef long long int lli;

int main(){
  int n;
  std::cin >> n;
  vector<lli> a(n);
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  vector<vector<lli> > dp(n + 1, vector<lli>(n + 1, 0));
  
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int s = j, t = (j + i)%n;
      if((n - i  - 1)%2 == 0){
        dp[s][t] = max(dp[(s + 1)%n][t] + a[s], dp[s][(t - 1 + n)%n] + a[t]);
      }else{
        if(a[s] > a[t]){
          dp[s][t] = dp[(s + 1)%n][t];
        }else{
          dp[s][t] = dp[s][(t - 1 + n)%n];
        }
      }
    }
  }
  lli ans = 0;
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[i][(i + n - 1)%n]);
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 34312
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	while(cin>>n,n){
		vi d(6);
		rep(i,6)d[i]=i+1;
		rep(i,n){
			string s;
			int tmp;
			cin>>s;
			if(s=="north"){
				tmp=d[0];
				d[0]=d[4];
				d[4]=d[5];
				d[5]=d[1];
				d[1]=tmp;
			}else if(s=="south"){
				tmp=d[0];
				d[0]=d[1];
				d[1]=d[5];
				d[5]=d[4];
				d[4]=tmp;
			}else if(s=="east"){
				tmp=d[0];
				d[0]=d[2];
				d[2]=d[5];
				d[5]=d[3];
				d[3]=tmp;
			}else{
				tmp=d[0];
				d[0]=d[3];
				d[3]=d[5];
				d[5]=d[2];
				d[2]=tmp;
			}
		}
		cout<<d[0]<<endl;
	}
}

Measured memory_bytes: 1212
#include <iostream>
#include <vector>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

int n;
int c[4];

int main(){
    cin >> n;
    rep(i, 4){
        c[i] = n % 10;
        n /= 10;
    }
    cout << (c[0] == c[1] && c[1] == c[2] || c[1] == c[2] && c[2] == c[3] ? "Yes" : "No") << endl;
    return 0;
}

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

using namespace std;

const int MX = 300, md = 1000000007;

int a[MX], b[MX], f[2 * MX], dp[2 * MX][2 * MX], freeCnt[2 * MX], n;

bool inside(int l, int r, int x) {
	if (l <= r) return l <= x && x <= r;
	return l <= x || x <= r;
}

int getFree(int l, int r) {
	int h;
	if (l <= r) h = freeCnt[r] - (l > 0 ? freeCnt[l - 1] : 0);
	else h = freeCnt[r] + freeCnt[2 * n - 1] - freeCnt[l - 1];
	return h;
}

int main() {
	int k;
	ignore = scanf("%d %d", &n, &k);
	fill(freeCnt, freeCnt + 2 * n, 1);
	for (int i = 0; i < k; i++) {
		ignore = scanf("%d %d", a + i, b + i);
		a[i]--;
		b[i]--;
		freeCnt[a[i]] = freeCnt[b[i]] = 0;
	}
	
	partial_sum(freeCnt, freeCnt + 2 * n, freeCnt);
	
	f[1] = 1;
	for (int i = 3; i < 2 * n; i += 2) f[i] = f[i - 2] * 1ll * i % md;
	
	int ans = 0;
	for (int len = 2; len <= 2 * n; len += 2) {
		for (int l = 0, r = len - 1; r < 2 * n; l++, r++) {
			bool ok = true;
			for (int e = 0; e < k && ok; e++) {
				ok = inside(l, r, a[e]) == inside(l, r, b[e]);
			}
			if (ok == false) continue;
			int h = getFree(l, r);
			dp[l][r] = f[max(h, 2) - 1];
			for (int lenp = 2, rp = (l + 1) % (2 * n); lenp < len; lenp += 2, rp = (rp + 2) % (2 * n)) {
				int g = getFree((rp + 1) % (2 * n), r);
				dp[l][r] = (dp[l][r] - dp[l][rp] * 1ll * f[max(2, g) - 1]) % md;
			}
			if (dp[l][r] < 0) dp[l][r] += md;
			ans = (ans + dp[l][r] * 1ll * f[max(2, 2 * (n - k) - h) - 1]) % md;
		}
	}
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace AtCoder {
    class Program {
        static void Main(string[] args) {

            var input = Console.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray();
            var a = input[0];
            var b = input[1];

            var ans = 0;

            if (a == b) {
                ans = a * 2;
            } else {
                ans = Math.Max(a, b) * 2 - 1;
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  int a,b;

  cin>>a>>b;
  if(a>0)
    cout<<"Positive"<<endl;
  else if(b<0){
    if((b-a)%2)
      cout<<"Positive"<<endl;
    else
      cout<<"Negative"<<endl;

  }else{
    cout<<"Zero"<<endl;
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = a; i < n; i++)
#define Repr(i, n, a) for (int i = n; i >= a; i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    reverse(all(a)), reverse(all(b));
    int ans = 0;
    rep(i, n)
    {
        int d = b[i] - (a[i] + ans) % b[i];
        if (d == b[i])
            d = 0;
        ans += d;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <cstdio>

long long n;
long long a[205];

int main() {
    scanf("%lld", &n);
    for (int i = 1; i <= 200; ++i) {
        a[i] = (long long)i * i * i * i * i;
        for (int j = 0; j < i; ++j)
            if (a[i] - a[j] == n) {
                printf("%d %d\n", i, j);
                return 0;
            } else if (a[i] + a[j] == n) {
                printf("%d %d\n", i, -j);
                return 0;
            }
    }
    return 0;
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define lf long double
#define F first
#define S second
typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <pair <ll,ll> >vii;
typedef vector <vector <ll> > vv;
typedef vector <string> vs;
#define mod 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lf w,h,x,y;
    cin>>w>>h>>x>>y;
    lf ans=w*h/2;
    printf("%.9Lf ",ans);
    if(x==(w)/2 && y==(h)/2)
    {
        printf("1\n");
    }
    else
    {
        printf("0\n");
    }
}


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

int main()
{
    int d, t, s;
    cin >> d >> t >> s;
    if (d <= t * s)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3684
n, x = map(int, input().split())
a = list(map(int, input().split()))

total = 0
for i in range(n-1):
    if a[i] + a[i+1] > x:
        eat = a[i] + a[i+1] - x
        total += eat
        if a[i+1] < eat:
            eat -= a[i+1]
            a[i+1] = 0
            a[i] = eat
        else:
            a[i+1] = a[i+1] - eat
print(total)


Measured memory_bytes: 14544
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ins()


def solve():
    return (N[0] == N[1] == N[2]) or (N[3] == N[1] == N[2])


print("Yes" if solve() else "No")


Measured memory_bytes: 9088
import collections

n = int(input())

x = []
y = []
for i in range(n):
    xx, yy = map(int, input().split())
    x.append(xx)
    y.append(yy)

vec = []
vec_set = []

for i in range(n):
    vec2 = []
    for j in range(n):
        vec2.append((x[i] - x[j], y[i] - y[j]))
        vec_set.append((x[i] - x[j], y[i] - y[j]))
    vec.append(vec2)

cc = collections.Counter(vec_set)

v_l = []
for key,value in cc.items():
    if key != (0,0):
        v_l.append(value)
if len(v_l) != 0:
    print(n - max(v_l))
else:
    print(1)

Measured memory_bytes: 4212
/**
*    author:  y_takano
*    created: 23.06.2020 16:11:32
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)

using namespace std;

struct _dice
{
    int dt, ds, de, dw, dn, du;
};

void dice(_dice &dice, char c)
{
    int tmp;

    switch (c)
    {
    case 'E':
        tmp = dice.dt;
        dice.dt = dice.dw;
        dice.dw = dice.du;
        dice.du = dice.de;
        dice.de = tmp;
        break;
    case 'N':
        tmp = dice.dt;
        dice.dt = dice.ds;
        dice.ds = dice.du;
        dice.du = dice.dn;
        dice.dn = tmp;
        break;
    case 'S':
        tmp = dice.dt;
        dice.dt = dice.dn;
        dice.dn = dice.du;
        dice.du = dice.ds;
        dice.ds = tmp;
        break;
    case 'W':
        tmp = dice.dt;
        dice.dt = dice.de;
        dice.de = dice.du;
        dice.du = dice.dw;
        dice.dw = tmp;
        break;
    }
}

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

    _dice sdice[100];

    int n;
    string s = "SSSSNESSSESSSWSSSWSSSESSS";
    bool flg = false;

    cin >> n;

    REP(i, n)
    {
        cin >> sdice[i].dt;
        cin >> sdice[i].ds;
        cin >> sdice[i].de;
        cin >> sdice[i].dw;
        cin >> sdice[i].dn;
        cin >> sdice[i].du;
    }

    REP(i, n)
    {
        FOR(j, i + 1, n)
        {
            REP(k, s.size())
            {
                dice(sdice[i], s[k]);
                if (sdice[i].dt == sdice[j].dt && sdice[i].ds == sdice[j].ds && sdice[i].de == sdice[j].de && sdice[i].dw == sdice[j].dw && sdice[i].dn == sdice[j].dn && sdice[i].du == sdice[j].du)
                {
                    flg = true;
                    break;
                }
            }
        }
    }

    if (flg)
    {
        cout << "No" << '\n';
    }
    else
    {
        cout << "Yes" << '\n';
    }

    return 0;
}


Measured memory_bytes: 3196
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5+5;
int a[N],s[N]={0};
int main()
{
	int n;
	cin >> n;
	for(int i = 1;i <= n;i++)
		cin >> a[i];
	int mx = 0;
	int t = 0;
	for(int i = 1;i < n;i++)
	{
		if(a[i] >= a[i+1])
		{
			t++;
			if(t > mx)
				mx = t;
		}
		else
		{
			t = 0;	
		}	
	}
	cout << mx << endl;
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <vector>
#include<bits/stdc++.h>

using namespace std;

struct Edge {
    int to;
    int cost;
};

int n;
vector<Edge> es[10000];
vector<int> dp[10000];

int dfs(int i, int j) {
	//???????????¶
    if (dp[i][j] >= 0) return dp[i][j];
    //cost???dp?????\?????????
    dp[i][j] = es[i][j].cost;
    //u?????????????????\?????????
    int u = es[i][j].to;
    for (int k=0; k<es[u].size(); k++) {
        if (es[u][k].to == i) continue;
        dp[i][j] = max(dp[i][j], dfs(u, k) + es[i][j].cost);
        //cout<<"i j"<<i<<" "<<j<<" "<<dp[i][j]<<endl;
    }
    return dp[i][j];
}

int main() {
    scanf("%d", &n);
    for (int i=0; i<n-1; i++) {
        Edge e;
        int a, b;
        //?????¬????????¨???Edge ???vectro<Edge>?????????????????????
        //??????????????????????????????????????????????????\??????????????????
        //??????????????????e??????????????§to?????\???????????????
        //???????????¨??????dp??????
        //dp??????????????\?????????????????¨???
        scanf("%d%d%d", &a, &b, &e.cost);
        e.to = b;
        es[a].push_back(e);
        dp[a].push_back(-1);
        e.to = a;
        es[b].push_back(e);
        dp[b].push_back(-1);
    }

    for (int i=0; i<n; i++) {
        for (int j=0; j<es[i].size(); j++) {
            if (dp[i][j] < 0) {
                dp[i][j] = dfs(i, j);
            }
        }
    }

    for (int i=0; i<n; i++) {
        int ans = 0;
        for (int j=0; j<dp[i].size(); j++) {
            ans = max(ans, dp[i][j]);
        }
        printf("%d\n", ans);
    }
}

Measured memory_bytes: 5252
#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
#define pb push_back
#define mp make_pair

const int MaxN = 1e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e9;

pair < double, double > p[MaxN];
pair < double, char > all[MaxN];
int n, k;

bool can(double rad) {
  int res = 1;
  for (int i = 1; i <= n && res < k; ++i) {
    int c = 1, sz = 0;
    for (int j = 1; j <= n; ++j) {
      if (i == j) {
        continue;
      }
      double d = hypot(p[i].first - p[j].first, p[i].second - p[j].second);
      if (d / 2 > rad) {
        continue;
      }
      pair < double, double > v = make_pair((p[j].first - p[i].first) / d, (p[j].second - p[i].second) / d);
      double l1 = d / 2;
      double l2 = sqrt(rad * rad - l1 * l1);
      l1 /= rad;
      l2 /= rad;
      pair < double, double > p1 = make_pair(v.first * l1 + v.second * l2, v.second * l1 - v.first * l2);
      pair < double, double > p2 = make_pair(v.first * l1 - v.second * l2, v.second * l1 + v.first * l2);
      double ang1 = atan2(p1.second, p1.first);
      double ang2 = atan2(p2.second, p2.first);
      if (ang1 > ang2) {
        c++;
      }
      all[sz++] = make_pair(ang1, 1);
      all[sz++] = make_pair(ang2 + 1e-10, -1);
    }
    sort(all, all + sz);
    for (int j = 0; j < sz; ++j) {
      c += all[j].second;
      if (res < c) {
        res = c;
      }
    }
  }
  return res >= k;
}

int main() {
  scanf("%d",&n);
  k=n;
  for (int i = 1; i <= n; ++i) {
  	scanf("%lf%lf",&p[i].first,&p[i].second);
  }
  double l = 0, r = 1e4;
  for (int it = 0; it < 1000; ++it) {
    double m = (l + r) / 2;
    if (can(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  cout.precision(8);
  cout << fixed << (l + r) / 2.0 << '\n';
  return 0;
}


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

#define f first
#define s second
#define ins insert
#define eb emplace_back
#define endl '\n'
#define ll long long
#define ld long double
#define vl vector<ll>
#define tc ll t; cin >> t; while (t--)2 2
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define sz(c) (ll) c.size()
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define trav(x,c) for(auto &x : c)
#define _for(i,a,n) for(ll i = a ; i < n ; ++i)
#define _rfor(i,a,n) for(ll i = n-1 ; i >= a ; --i)
#define dx(x) cout << #x << ": " << x << endl;
#define dc(c) trav(x,c) cout << x << " "; cout << endl;
#define godspeed ios::sync_with_stdio(0); cin.tie(0);

int main() {
    godspeed;
 	ll n, m; cin >> n >> m;

 	ll a, b, ans = -1;

 	for(int i = 1500 ; i >= 0 ; --i) {
 		a = 0.08*i;
 		b = 0.1*i;
 		if(a == n && b == m) ans = i;
 	}

 	cout << ans;
}

Measured memory_bytes: 3696
#include <stdio.h>

int main(void) {
	int A, B, C, D;
	int asumisu, mizuhasu;
	if (scanf("%d%d%d%d", &A, &B, &C, &D) != 4) return 1;
	asumisu = A + B;
	mizuhasu = C + D;
	if (asumisu > mizuhasu) puts("Left");
	else if (asumisu < mizuhasu) puts("Right");
	else puts("Balanced");
	return 0;
}


Measured memory_bytes: 128
#                         author:  kagemeka 
#                         created: 2019-11-07 00:57:57(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator

def main():
    n = int(sys.stdin.readline().rstrip())
    a = [0] + [int(x) for x in sys.stdin.readline().split()] + [0]
    way = 0
    for i in range(n+1):
        way += abs(a[i+1] - a[i])
    
    for i in range(1, n+1):
        pre, cur, nex = a[i-1], a[i], a[i+1]
        if pre <= cur <= nex or pre >= cur >= nex:
            ans = way
        elif pre <= nex <= cur or pre >= nex >= cur:
            ans = way - abs(nex - cur) * 2
        elif cur <= pre <= nex or cur >= pre >= nex:
            ans = way - abs(cur - pre) * 2
        
        print(ans)

if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 14052
#include <iostream>
#include <algorithm>

using namespace std;

static const int MAX = 200000;

int main() {
    int n, R[MAX];

    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> R[i];
    }


    int maxv = -1000000000;
    int minv = R[0];
    for(int j = 1; j < n; j++) {
        maxv = max(maxv, R[j]-minv);
        minv = min(minv, R[j]);
    }

    cout << maxv << endl;


    return 0;
    
}


Measured memory_bytes: 3816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl "\n"
#define rep(i,n) for(ll i=0; i<(n); i++)
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sortup(V) sort(V.begin(), V.end())
#define sortdown(V) sort(V.rbegin(), V.rend())
#define MOD 998244353 //1000000007

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

    // solution comes here
    ll a, b, x;
    cin >> a >> b >> x;
    cout << b/x - a/x + (a%x==0) << nl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
hash = {}

n.times{|i|
    word = gets.chomp
    hash[word] ||= 0
    hash[word] += 1
}

max_value = hash.values.max
result_hash = hash.select{|k, v| v == max_value}

result_hash.sort.each {|k,v|
    puts k
}

Measured memory_bytes: 55016
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int v[3];
  FOR(i,0,3)cin>>v[i];
  sort(v,v+3);
  int ans=0;
  ans=v[2]-v[0]+v[2]-v[1];
  if(ans%2==1){
    ans=v[2]-v[0]+v[2]-v[1]+3;
  }
  cout<<ans/2<<endl;
  

}

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

int main() {
  string S;
  cin >> S;
  int a = 0, b = 0;
  for(int i = 0; i < S.size(); i++) {
    if (S.at(i) == '0') a++;
    else b++;
  }
  if (a <= b) cout << 2 * a << endl;
  else cout << 2 * b << endl;
}

Measured memory_bytes: 512
import numpy as np
import itertools

n, m, x = map(int, input().split())
num_list = [list(map(int, input().split())) for _ in range(n)]

ans = -1

num_list.sort(key=lambda x: x[0])

result = []
for n1 in range(1,len(num_list)+1):
    for conb in itertools.combinations(num_list, n1):
        result.append(np.sum(conb, axis=0))

result.sort(key=lambda x: x[0])

for r in result:
    if min(r[1:]) >= x:
        ans = r[0]
        break

print(ans)


Measured memory_bytes: 28392
using System;
using System.Linq;

class B
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var a = read();
		var h = read();

		var dp = Enumerable.Repeat(int.MaxValue, a[0] + 1).ToArray();
		dp[1] = 0;
		for (int i = 2; i <= a[0]; i++)
			for (int j = Math.Min(a[1], i - 1); j > 0; j--)
				dp[i] = Math.Min(dp[i], dp[i - j] + Math.Abs(h[i - j - 1] - h[i - 1]));
		Console.WriteLine(dp[a[0]]);
	}
}


Measured memory_bytes: 21216
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ANickname {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        string s;
        cin >> s;
        cout << s.substr(0, 3) << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ANickname solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3616
#include "iostream"
using namespace std;

int main(void)
{
    long num1, num2;

    while (cin >> num1 >> num2) {

        num1 += num2;

        num2 = 0;
        while(num1 > 0) {
            num2++;
            num1 /= 10;
        } 

        cout << num2 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
import java.math.BigDecimal;
import java.math.RoundingMode;
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();
		BigDecimal a = new BigDecimal(A).divide(new BigDecimal(0.08),0,RoundingMode.UP);
		BigDecimal b = new BigDecimal(B).divide(new BigDecimal(0.1),0,RoundingMode.UP);
//		double a = A / 0.08;
//		double b = B / 0.1;
		BigDecimal min = a.compareTo(b) == -1 ? a : b; 
		BigDecimal max = a.compareTo(b) == -1 ? b : a; 
//		BigDecimal min = a < b ? new BigDecimal(a) : new BigDecimal(b); 
//		BigDecimal max = a < b ? new BigDecimal(b) : new BigDecimal(a); 
		
		int ans = -1;
		for (int i = min.intValue(); i <= max.intValue(); i++) {
			BigDecimal x = new BigDecimal(i).multiply(new BigDecimal(0.08)).setScale(0,BigDecimal.ROUND_DOWN);
			BigDecimal y = new BigDecimal(i).multiply(new BigDecimal(0.1)).setScale(0,BigDecimal.ROUND_DOWN);
			if (x.compareTo(new BigDecimal(A)) == 0 && y.compareTo(new BigDecimal(B)) == 0) {
				ans = i;
			}
		}
		System.out.println(ans);			
	}

	
	// ユークリッドの控除法(最大公約数を求める)
	private static long gcd(long a, long b) {
		if (b == 0) {
			return a;
		}
		return gcd(b, a % b);
	}

	// 複数の最大公約数を求める
	private static long gcdex(long param[]) {
		long g = gcd(param[0], param[1]);
		for (int i = 1; i < param.length-1; i++) {
			g = gcd(g, param[i+1]);
		}
		return g;
	}

	// 最小公倍数を求める
	private static long lcm(long a, long b) {
		return (a * b) / gcd(a, b);
	}

	//
	private static long all(long n, long count, int N) {
		if (count == N) {
			return count;
		}
		return all(1, count, N);
	}

}

Measured memory_bytes: 28100
#include<bits/stdc++.h>
using namespace std;
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;}
int d,w,field[15][15];
int main(){
  while(1){
    int ans=-1;
    cin >> d >> w;
    if(d==0 && w==0) break;
    for(int i=0;i<d;i++)for(int j=0;j<w;j++) cin >> field[j][i];
    for(int i=1;i<=w-2;i++)for(int j=1;j<=d-2;j++)for(int k=1;k<=w-2;k++)for(int l=1;l<=d-2;l++){
      int circuit_min=114514;
      //cout << "(" << i << "," << j<< ")" << endl;
      //cout << "(" << k << "," <<l << ")" << endl;
      for(int x=i-1;x<=k+1;x++)for(int y=j-1;y<=l+1;y++){
        if((i<=x && x<=k) && (j<=y && y<=l));
        else chmin(circuit_min,field[x][y]);
      }
      //cout << "circuit_min:" << circuit_min << endl;
      int in_max = -1;
      for(int x=i;x<=k;x++)for(int y=j;y<=l;y++){
        chmax(in_max,field[x][y]);
        //cout << field[x][y] << endl;
      }
      //cout <<  "in_max:" << in_max << endl;
      if(circuit_min>in_max){
        int sum=0;
        for(int x=i;x<=k;x++)for(int y=j;y<=l;y++) sum+=circuit_min-field[x][y];
        chmax(ans,sum);
      }
      //cout << "ans;" << ans << endl;
    }
    if(ans==-1) cout << "0" << endl;
    else cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3124
n = int(input())
sp = [input().split() + [i] for i in range(1,n+1)]

town = set()
for i in sp:
    town.add(i[0])

d = {}
for i in town:
    d[i] = []

for i in sp:
    d[i[0]].append([int(i[1]), i[2]])

town = sorted(list(town))

for i in town:
    tmp = d[i]
    tmp.sort(reverse=True)
    for j in tmp:
        print(j[1])

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;

template<typename A,typename B> inline void chmin(A &a,B b){if(a>b) a=b;}
template<typename A,typename B> inline void chmax(A &a,B b){if(a<b) a=b;}
//-----------------------------------------------------------------------

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

    int n,m,a;
    while(cin>>n>>m>>a,n|m|a)
    {
        a--;
        int num[105];
        REP(i,n) num[i]=i;

        vector<P> v;
        REP(i,m){
            int h,p,q;
            cin>>h>>p>>q;
            p--;
            v.pb(P(h,p));
        }
        sort(v.rbegin(),v.rend());

        REP(i,m){
            int pos=v[i].second;
            swap(num[pos],num[pos+1]);
        }

        REP(i,n){
            if(num[i]==a) cout<<i+1<<endl;
        }
    }
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Enum various numbers
//-------------------------------------------------
namespace Enum
{
    using fint = ::std::int_fast64_t;
    //素因数分解(素因数列挙)
    ::std::map<fint,int> factor(fint n)
    {
        ::std::map<fint,int> ret;
        for(fint i=2; i*i<=n; i++){
            while(n%i==0){
                ret[i]++;
                n/=i;
            }
        }
        if (n!=1) ret[n]++;
        return ret;
    }
    //約数列挙
    ::std::vector<fint> divisor(fint n)
    {
        ::std::vector<fint> ret;
        for(fint i=1; i*i<=n; i++){
            if (n%i==0){
                ret.push_back(i);
                if (i*i!=n) ret.push_back(n/i);
            }
        }
        return ret;
    }
    //商列挙(割る最小の数と商のペア)
    ::std::vector<::std::pair<fint,fint> > quotient(fint n)
    {
        ::std::vector<::std::pair<fint,fint> > ret;
        fint i=0;
        for(i=1; i*i<=n; i++){
            ret.emplace_back(i,n/i);
        }
        for(; i<=n; i++){
            fint d = n/i;
            ret.emplace_back(i,d);
            i+=(n-d*i)/d;
        }
        return ret;
    }
    //素数判定(おまけ)
    bool isprime(fint n)
    {
        for(fint i=2; i*i<=n; i++){
            if (n%i==0) return false;
        }
        return true;
    }
}

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    int ans=0;
    for(int i=1; i<=n; i+=2){
        auto t = Enum::factor(i);
        ll div=1;
        for(auto e:t){
            div*=e.se+1;
        }
        if (div==8) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
	int n;
	cin>>n;
	long long a[n],b[n];
	rep(i,n)cin>>a[i]>>b[i];
	int num=n-1;
	long long cnt=0;
	while(num>=0){
		if(a[num]%b[num]!=0)cnt+=(a[num]/b[num]+1)*b[num]-a[num];
		num--;
		if(num>=0)a[num]+=cnt;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
//????????¢?´¢
int main(){
    int N;
    cin >> N;
    vector<int> vc(N);
    for( auto&& x : vc ){
        cin >> x;    
    }
    sort(vc.begin(),vc.end());
    int M;
    cin >> M;
    vector<int> vc2(M);
    int count{};
    for( auto&& x : vc2 ){
        cin >> x;
        int left{},right = N, mid{};
        while( left < right ){            
            mid = ( left + right ) / 2;
            if( x == vc[mid] ){
                count++;
                break;
            }
            if( x > vc[mid] ){
                left = mid + 1;
            }else if( x < vc[mid] ){
                right = mid;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3268
#include <stdio.h>
int main(void){
    int a, b, c, x;
    scanf("%d %d %d\n", &a, &b, &c);
    if(a>b){
        x = b;
        b = a;
        a = x;
      }
    if(b>c){
        x = c;
        c = b;
        b = x;
    }
     if(a>b){
        x = b;
        b = a;
        a = x;
     }
      printf("%d %d %d\n", a, b, c);
      return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

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

char s[1001];

bool check(int l, int r){
	while(l < r)
	if(s[l] != s[r])
	return false;
	else ++l, --r;
	return true;
}

int n;
int main(){
	scanf("%s", s + 1);
	n = strlen(s + 1);
	if(check(1, n) && check(1, (n - 1) / 2) && check((n + 3) / 2, n))
	puts("Yes");
	else
	puts("No");
	return 0;
}

Measured memory_bytes: 256
//abc075_c.cpp
//Sat May 26 13:45:56 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;

int n,m;
bool visit[50];
bool graph[50][50];


void dfs(int v){
	visit[v] = true;
	for (int i=0;i<n;i++){
		if (visit[i] == true){
			continue;
		}else if (graph[v][i] == false){
			continue;
		}
		dfs(i);
	}
}


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

	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			graph[i][j] = false;
		}
	}

	int a[m],b[m];
	for (int i=0;i<m;i++){
		cin >> a[i] >> b[i];
		a[i] = a[i] -1;
		b[i] = b[i] -1;
		graph[a[i]][b[i]] = true;
		graph[b[i]][a[i]] = true;
	}

	int bridge = 0;

	for (int i=0;i<m;i++){
		graph[a[i]][b[i]] = false;
		graph[b[i]][a[i]] = false;

		for (int j=0;j<n;j++){
			visit[j] = false;
		}

		dfs(0);

		bool bridgeflag = false;

		for (int j=0;j<n;j++){
			if (visit[j] == false){
				bridgeflag = true;
			}
		}

		if (bridgeflag == true){
			bridge++;
		}
		
		graph[a[i]][b[i]] = true;
		graph[b[i]][a[i]] = true;
	}

	cout << bridge << endl;
}

Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        return n * n;
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	int mx=INT_MIN;
	int k=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(mx<a[i]){
			mx=a[i];
			k=i;
		}
	}
	int mx1=INT_MIN;
	for(int i=0;i<n;i++){
		if(i!=k)
			mx1=max(mx1,a[i]);
	}
	for(int i=0;i<n;i++){
		if(i==k)
			cout<<mx1<<endl;
		else
			cout<<mx<<endl;
	}
	return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;

#define pi 3.141592653589
#define repeat(i,n) for(int i=0;i<n;i++)

int main(){
	int r, c;
	int **a;
	cin >> r >> c;

	//表のための配列を確保
	a = new int*[r + 1];
	repeat(i, r + 1)
	{
		a[i] = new int[c + 1];
	}

	//表の各要素を初期化
	repeat(i, r + 1)
	{
		repeat(j, c + 1)
		{
			a[i][j] = 0;
		}
	}



	//表の各要素に値を入力
	repeat(i, r)
	{
		repeat(j, c)
		{
			cin >> a[i][j];
		}
	}
	
	

	//第r+1行　第c+1列の値を計算
	repeat(i, r)
	{
		repeat(j, c)
		{
			a[i][c] += a[i][j];	//第c+1列
			a[r][j] += a[i][j];	//第r+1行
		}
	}
	
	//a[r][c]を計算
	repeat(i, r)
	{
		a[r][c] += a[i][c];
	}

	//表を表示
	repeat(i, r + 1)
	{
		repeat(j, c + 1)
		{
			cout << a[i][j];
			if (j != c) cout << " ";
			else if (j == c) cout << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 1228
#include<iostream>


double two_high(double A,double B,double E)
{
	return (B-A)*E;
}

double two_low(double A,double B,double C)
{
	return (B-A)*C;
}
double penetrate(double A,double B,double C,double D,double E)
{
	return (-A)*C+D+B*E;
}

main()
{
	double A,B,C,D,E,temp;
	std::cin>>A>>B>>C>>D>>E;
	if(A>=0)
	temp=two_high(A,B,E);
	else if(B<=0)
	temp=two_low(A,B,C);
	else
	temp=penetrate(A,B,C,D,E);
	std::cout<<temp<<std::endl;
}




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

int main() {

	int n, m;	cin >> n >> m ;
	vector <vector <int>> dp(n, vector <int> (m, 0));

	vector <string> s(n);
	for (auto &i: s)	cin >> i;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (i == 0 && j == 0)		
				dp[i][j] = (s[i][j] == '#');
			else if (i == 0)
				dp[i][j] = dp[i][j - 1] + (s[i][j] == '#' && s[i][j - 1] != '#');
			else if (j == 0)
				dp[i][j] = dp[i - 1][j] + (s[i][j] == '#' && s[i - 1][j] != '#');
			else	
				dp[i][j] = min(dp[i][j - 1] + (s[i][j] == '#' && s[i][j - 1] != '#'), dp[i - 1][j] + (s[i][j] == '#' && s[i - 1][j] != '#'));
		}
	}

	cout << dp[n - 1][m - 1] << endl;

	return 0;
}


Measured memory_bytes: 256
local n=io.read("*n")
local a={}
local suma=0
for i=1,n do
    a[i]=io.read("*n")
    suma=suma+(i%2==0 and -a[i] or a[i])
end

local x={suma}
for i=1,n-1 do
    x[i+1]=2*a[i]-x[i]
end
print(table.concat(x," "))

Measured memory_bytes: 8876
#include <bits/stdc++.h>
using namespace std;
static const int INF=1000000000;

int main() {
  int N,K;
  cin>>N>>K;
  int h[N];
  int dp[N];
  for(int i=0;i<N;i++){
    cin>>h[i];
  }
  for(int i=0;i<N;i++){
    dp[i]=INF;
  }
  dp[0]=0;
  for(int i=1;i<N;i++){
    for(int j=1;j<=K;j++){
      if(i-j<0) break;
      dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
    }
  }
  cout<<dp[N-1]<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#define SIZE 4005
#define MOD 998244353

using namespace std;
typedef long long int ll;

ll C[SIZE][SIZE];
ll rt[SIZE];

void make()
{
	for(int i=0;i<SIZE;i++)
	{
		C[i][i]=C[i][0]=1;
		for(int j=1;j<i;j++)
		{
			C[i][j]=C[i-1][j-1]+C[i-1][j];
			if(C[i][j]>=MOD) C[i][j]-=MOD;
		}
	}
	rt[0]=1;
	for(int i=1;i<SIZE;i++) rt[i]=rt[i-1]*2LL%MOD;
}
ll solve(int A,int B,int N)
{
	ll ret=0;
	for(int i=0;i<=A;i++)//the number of pairs used
	{
		if(i>N) break;
		ll way=C[A][i]*rt[i]%MOD;
		ret+=C[N+B-1][N-i]*way%MOD;
		if(ret>=MOD) ret-=MOD;
	}
	return ret;
}
int main()
{
	make();
	int n,k;
	scanf("%d %d",&k,&n);
	for(int i=2;i<=2*k;i++)
	{
		ll ret;
		if(i%2==1)
		{
			int cnt=0;
			if(i<=k+1) cnt=i/2;
			else cnt=(2*k-i)/2+1;
			ret=solve(cnt,k-cnt*2,n);
		}
		else
		{
			int cnt=0;
			if(i<=k+1) cnt=i/2-1;
			else cnt=(2*k-i)/2;
			ret=solve(cnt,k-cnt*2-1,n)+solve(cnt,k-cnt*2-1,n-1);
		}
		printf("%lld\n",ret%MOD);
	}
	return 0;
}


Measured memory_bytes: 123776
#!/usr/bin/python
# -*- coding: utf-8 -*-

import numpy as np

def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return np.array(x)

X = int(input())

a = 8
for i in range(2,11):
    if 200*i <= X and 200*(i+1) > X:
        print(a)
    a -= 1



Measured memory_bytes: 27112
#include<bits/stdc++.h> 
using namespace std;
int main(){
	int x,y;
	cin >> x >> y;
	if(x==2&&y==2){
		cout << "Yes" << endl;
	}
	else if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11)){
		cout << "Yes" << endl;
	}
	else if((x==1||x==3||x==5||x==7||x==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12)){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7; 
const int SIZE=1<<21;
string s;
int k;
ll fac[SIZE],rev[SIZE];
inline ll Pow(ll x,ll y){
	ll res=1;
	while(y){
		if(y&1){
			res=res*x%mod;
		}
		y>>=1;
		x=x*x%mod;
	}
	return res;
}
inline ll C(int x,int y){
	if(y<0||y>x){
		return 0;
	}
	return fac[x]*rev[y]%mod*rev[x-y]%mod;
} 
inline void build(){
	fac[0]=1;
	for(int i=1;i<SIZE;++i){
		fac[i]=fac[i-1]*i%mod;
	}
	rev[SIZE-1]=Pow(fac[SIZE-1],mod-2);
	for(int i=SIZE-2;i>=0;--i){
		rev[i]=rev[i+1]*(i+1)%mod;
	}
}
int main(){
	cin>>k>>s;
	build();
	int n=s.size();
	long long ans=0;
	for(int i=n;i<=k+n;++i){
		ans+=C(k+n,i)*Pow(25,k+n-i)%mod;
		ans%=mod;
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 37192
#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
using ld = long double;
using ulli = unsigned long long int;
#define filein freopen ("in.txt", "r", stdin)
#define fileout freopen ("out.txt", "w", stdout)
#define dbg(args...) do {cerr << #args << " : "; debug(args); } while(0)
#define all(v) ((v).begin()),((v).end()) 
#define pb emplace_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
void debug () {cerr << endl;}
template < typename T, typename ... hello>void debug( T arg, const hello &... rest) {cerr << arg << ' ';debug(rest...);}
int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
void solve(){
	double r;
	cin>>r;
	cout<<2*PI*r;
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}



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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

typedef long long ll;

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

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> a(N), a2(N);
    rep(i, N) cin >> a[i];
    rep(i, N) a2[i] = a[i] / 2;

    ll l2 = a2[0];
    for (int i = 1; i < N; i++) l2 = lcm(l2, a2[i]);

    int cnt = 0;
    while (a2[0] % 2 == 0) a2[0] /= 2, cnt++;
    for (int i = 1; i < N; i++) {
        int c = 0;
        while (a2[i] % 2 == 0) a2[i] /= 2, c++;
        if (cnt != c) {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << (M / l2 + 1) / 2 << endl;
}

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

using std::cin;
using std::cout;
using std::endl;
using std::string;

int main() {
  int K;
  string S;

  cin >> K;
  cin >> S;

  if (S.length() > K) {
    cout << S.substr(0, K) << "..." << endl;
  } else {
    cout << S << endl;
  }
}


Measured memory_bytes: 3632