akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    string code;
    int kupc[5]={0};
    cin>>code;
    for(int i=0;i<code.size();i++){
        if(code[i]=='K')kupc[0]++;
        if(code[i]=='U')kupc[1]++;
        if(code[i]=='P')kupc[2]++;
        if(code[i]=='C')kupc[3]++;
    }
    sort(kupc,kupc+4);
    cout<<kupc[0]<<endl;
    return 0;
}

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

#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,n)  for(int i=0;i<n;i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;



int main(){
    cinsc;
    string s;
    cin>>s;
    int64 no_of_black=0,res=0;
    for(auto c:s){
        if(c=='B'){
            no_of_black++;
        }else if(c=='W'){
            res+=no_of_black;
        }
    }
    cout<<res<<endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0, i_length = (n); i < i_length; i++)
#define MOD 1000000007
#define ll long long

int main() {
	ll a, b, k;
	cin >> a >> b >> k;
	rep(i, k) {
		if (a % 2 == 1) a--;
		b += a / 2;
		a /= 2;

		swap(a, b);
	}
	if (k % 2 == 1) swap(a, b);

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

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    ll u = 0;
    rep(i, n) {
        ll h;
        cin >> h;
        if(u - h >= 2) {
            out("No");
            re0;
        }
        chmax(u, h);
    }

    out("Yes");
    re0;
}

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

using namespace std;

int main()
{
  int i,N,k,m;
  cin>>N;
  vector<int> vec(N);
  int sum=0;
  for(i=0;i<N;i++)
  {
      cin>>k;
      vec[i]=k;
      sum=sum+vec[i];
  }
  int T;
  cin>>T;
  while(T--)
  {
      int temp;
      temp=sum;
      cin>>k>>m;
      cout<<temp-vec[k-1]+m<<endl;
      
  }
    
}


Measured memory_bytes: 256
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n, b, c;
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>s;
    for (int i = 0; i < s.size(); i++)
    {
        
        for(int j=0;j<n;j++){
            s[i]++;
            if(s[i]=='['){
                s[i]='A';
            }
        }
    }
    cout << s << "\n";
}



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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

int main(){
   string s; cin >> s;
  ll ans = 0;
  ll n = s.size();
  REP(i, n - 1){
    ans += (s[i] != s[i + 1]);
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] test = new int[5];
        for (int i = 0; i<5 ;i++){
            test[i] = scanner.nextInt();
        }

        for (int i = 0; i<5 ;i++){
            if (test[i] == 0) {

                System.out.println(i + 1);

            }
        }
    }
}


Measured memory_bytes: 35628
def main():
    n = int(input())
    A = list(map(int, input().split()))
    c = 0
    for i in range(n):
        if A[i] < 0:
            c += 1
            A[i] = -A[i]
    if c % 2 == 0:
        print(sum(A))
    else:
        print(sum(A) - 2 * min(A))

if __name__ == '__main__':
    main()


Measured memory_bytes: 14224
using System;

class IDONTKNOWCSHARP
{
    public static void Main()
    {
        string[] values = Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
        int num = int.Parse(values[0]);
        int A = int.Parse(values[1]);
        int B = int.Parse(values[2]);

        int trainPrice = A * num;
        int taxiPrice = B;

        if (trainPrice > taxiPrice)
        {
            Console.WriteLine(taxiPrice);
        }
        else
        {
            Console.WriteLine(trainPrice);
        }
    }



}

Measured memory_bytes: 27544
import java.util.Scanner;
import java.util.Arrays;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      	int town[][] = new int[n][2];
      	double ave = 0;
      	for(int i = 0; i < n; i++){
        	town[i][0] = Integer.parseInt(sc.next());
          	town[i][1] = Integer.parseInt(sc.next());
        }

      
      	int x, y;
      	for(int i = 0; i < n; i++){
        	for(int j = i + 1; j < n; j++){
              	x = Math.abs(town[i][0] - town[j][0]);
              	y = Math.abs(town[i][1] - town[j][1]);
            	ave += Math.sqrt(Math.pow(x,2)+Math.pow(y,2));
            }
        }
        ave *= 2;
      	
     	System.out.println(ave/n);
      	
      
      
	}
}

Measured memory_bytes: 21972
# include <cmath>
# include <iostream>
# include <queue>
# include <set>
# include <stack>
# include <string>
# include <vector>


using namespace std;


const int N = 13;
const int MOD = 1e9+7;
const int REM = 5;


int main() {
    string s; cin >> s;
    int n_digits = s.size();

    vector<vector<long>> dp(n_digits+1, vector<long>(13, 0));
    dp[0][0] = 1;

    int c;
    for (int i=0; i<n_digits; i++) {
        c = (s[i] == '?') ? -1 : s[i]-'0';

        if (c == -1) {
            for (int j=0; j<10; j++) {
                for (int k=0; k<13; k++) {
                    dp[i+1][(k*10+j)%N] += dp[i][k];
                }
            }
        }

        else {
            for (int k=0; k<13; k++) {
                dp[i+1][(k*10+c)%N] += dp[i][k];
            }
        }

        for (int k=0; k<13; k++) {
            dp[i+1][k] %= MOD;
        }
    }

    cout << dp[n_digits][REM] << endl;
}


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

#define int long long

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

const int mod = 1e9+7;

int N;
auto dp = vectors(111, 9, 9, 9, 0);

bool isAGC(vector<int> C) {
  return C[0] == 0 and C[1] == 1 and C[2] == 2;
}


signed main() {
  cin >> N;
  int M = 4;

  // 3文字目までを初期化
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        if (i == 0 and j == 1 and k == 2) continue;
        if (i == 0 and j == 2 and k == 1) continue;
        if (i == 1 and j == 0 and k == 2) continue;
        dp[3][i][j][k] = 1;
      }
    }
  }

  for (int i = 3; i < N; i++) {
    for (int c3 = 0; c3 < M; c3++) { // iの3文字前
      for (int c2 = 0; c2 < M; c2++) { // iの2文字前
        for (int c1 = 0; c1 < M; c1++) { // iの1文字前
          for (int now = 0; now < M; now++) { // 新しく選ぶ文字
            // AGC文字列になるかどうかの判定
            bool ok = true;
            vector<int> t = {c3, c2, c1, now};
            if (isAGC({c3, c2, c1}) or isAGC({c2, c1, now})) ok = false;

            for (int j = 0; j < t.size()-1; j++) {
              vector<int> tt = t;
              swap(tt[j], tt[j+1]);
              if (isAGC({tt[0], tt[1], tt[2]}) or isAGC({tt[1], tt[2], tt[3]})) ok = false;
            }

            // AGC文字列にならないなら遷移させる
            if (ok) {
              Add(dp[i+1][c2][c1][now], dp[i][c3][c2][c1]);
            }
          }
        }
      }
    }
  }

  int ans = 0;
  for (int c3 = 0; c3 < M; c3++) {
    for (int c2 = 0; c2 < M; c2++) {
      for (int c1 = 0; c1 < M; c1++) {
        Add(ans, 1LL*dp[N][c3][c2][c1]);
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 896
stack = [0]*1000
top = 0

def push(x):
    global stack
    global top

    top += 1
    stack[top] = x

def pop():
    global top
    global stack

    top -= 1
    return(stack[ top + 1 ])

def main():
    global stack
    global top
    a = 0
    b = 0

    A = list(input().split())

    for i in range(len(A)):
        if A[i] not in ['+','-','*']:
            push(int(A[i]))
        elif A[i] == '+':
            a = pop()
            b = pop()
            push(b+a)
        elif A[i] == '-':
            a = pop()
            b = pop()
            push(b-a)
        elif A[i] == '*':
            a = pop()
            b = pop()
            push(b*a)

    return stack[1]

print(main())



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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int64_t n;
  cin >> n;
  vector<int64_t> a(3*n);
  rep(i,3*n){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int64_t sum = 0;
  rep(i,n){
    sum += a.at(2*i+1);
  }
  cout << sum << endl;
    
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
	int x;
	cin >> x;
	int a, b, happy;
	a = x / 500;
	b = (x - 500 * a) / 5;
	happy = a * 1000 + b * 5;
	cout << happy << endl;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
int N;
vector<int> G[10010];
vector<int> c;
bool flag[10010];
int ans[10010];
int main(){
    cin >> N;
    for(int i = 1; i < N; i++){
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int sum = 0;
    for(int i = 0; i < N; i++){
        int x;
        cin >> x;
        sum += x;
        c.push_back(x);
    }
    sort(c.rbegin(), c.rend());
    queue<int> q;
    q.push(1);
    flag[1] = true;
    int idx = 0;
    while(!q.empty()){
        int a = q.front();
        ans[a] = c[idx++];
        q.pop();
        for(int i = 0; i < G[a].size(); i++){
            int g = G[a][i];
            if(!flag[g]){
                flag[g] = true;
                q.push(g);
            }
        }
    }
    cout << sum - c[0] << endl;
    for(int i = 1; i <= N; i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>

using namespace std;
int N, M, A, B, C, D, x1, x2, y1, y2;
int K[32][32];
const int inf =1001001001;

int main(){
  for (int i = 0; i < 32; ++i)
  {
    for (int j = 0; j < 32; ++j)
    {
     K[i][j]= inf;
    }
  }
  scanf("%d%d", &N, &M);
  for(int i=0; i<M; ++i){
    scanf("%d,%d,%d,%d", &A, &B, &C, &D);
    // cerr << "read " << A << " " << B << " " << C << " " << D << endl;
    K[A-1][B-1]=C;
    K[B-1][A-1]=D;
  }


  for (int k=0;k<N;k++){
    for (int i = 0; i < N; i++){
      for (int j = 0; j < N; j++){
        if(K[i][j]>(K[i][k]+K[k][j])){
          K[i][j]=K[i][k]+K[k][j];
        }
      }
    }
  }
  scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);

  cout << y1-K[x1-1][x2-1]-y2-K[x2-1][x1-1]<< endl;



}

Measured memory_bytes: 1212
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INF INT_MAX
#define LLINF LLONG_MAX
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007
#define MODB  998244353 

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
    for (T& x: vec) { is >> x; }
    return is;
}

int main() {
	ll ans = 0;
	ll tmp;
	int n; cin >> n;
	vector<int> a(n); cin >> a;
	vector<int> so(n); REP(i, n) so[i] = a[i];
	sort(so.begin(), so.end());
	REP(i, n){
		auto it = lower_bound(so.begin(), so.end(), a[i]);
		//cout << *it << endl;
		int j = distance(so.begin(), it);
		if((j - i) % 2 != 0) ans++;
	}
	cout << ans / 2 << endl;
}


Measured memory_bytes: 3992
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

H, W, K = map(int, readline().split())
C = np.frombuffer(read(), 'S1').reshape(H, -1)[:, :W]

C = 1 * (C == b'#')

def f(C, x, y):
    D = C.copy()
    for i in range(H):
        if x & (1 << i):
            D[i] = 0
    for i in range(W):
        if y & (1 << i):
            D[:, i] = 0
    return D.sum() == K

ans = 0
for x in range(1 << H):
    for y in range(1 << W):
        ans += f(C, x, y)
print(ans)

Measured memory_bytes: 27248
function main(input) {
    var data = input.split('\n');
    var size = Number(data[0]);
    //size????????´??°
    var array = data[1].split(' ').map(Number);
    var numSum = 0;
    var output = [];
    var min = 1000000;
    var max = -10000000;
    for (var i = 0; i < size; i++){
        numSum += array[i];
        min = Math.min(min, array[i]);
        max = Math.max(max, array[i]);
    }
    console.log(min, max, numSum);
}
process.stdin.resume();
var input = '';  
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  main(input);
});

Measured memory_bytes: 17276
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main() {
	ll a, b, k;
	cin >> a >> b >> k;

	if (a <= k) {
		k = k - a;
		a = 0;
	}
	else {
		a = a - k;
		k = 0;
	}
	if (b <= k) {
		k = k - b;
		b = 0;
	}
	else {
		b = b - k;
		k = 0;
	}

	cout << a <<" "<< b << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
#define endl "\n"
#define ff first
#define ss second 
#define pb push_back
#define INF ll(1e18)
#define MOD 1000000007
#define debug(x) cout<<x<<"\n";
#define pll pair<ll,ll>
#define mp make_pair
#define Craig ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define all(v) v.begin(),v.end()
#define MAX 9999999999999
#define vll vector<ll>
 
int main()
{ 
  

    ll a[4],k,mx=-(pow(10,9)*pow(10,9)+99);
    for(ll i=0;i<4;i++)
    {
      cin>>a[i];
    }
    for(ll i=0;i<2;i++)
    {
      for(ll j=2;j<4;j++)
      {
        if(a[i]*a[j]>mx)
          mx=a[i]*a[j];
      }
    }
    cout<<mx;
}

Measured memory_bytes: 3628
parseint(x) = parse(Int, x)
int() = readline() |> parseint
strs() = readline() |> chomp |> split

function main()
    n = int()
    spt::Array{Array{Any, 1}, 1} = [begin sp = strs(); Any[sp[1], parseint(sp[2]), i] end for i = 1:n]
    sort!(spt, lt = (u, v) -> u[1] == v[1] ? u[2] > v[2] : u[1] < v[1])
    ans = Array{Int}(n)
    for i = 1:n
        println(spt[i][3])
    end
end

main()

Measured memory_bytes: 115404
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(double);
		void decrement(void);
		void decrement(double);
		double getResult(void);
	private:
		double result;
	};
	void Ans::showResult(void) {
		printf("%.0lf\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(double value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(double value) {
		this->result -= value;
	}
	double AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void input(Str* str) {
		str->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				str->push_back(row);
				row = "";
			} else {
				row += buf[i];
			}
		}
		str->push_back(row);
	}
	void input(Num* num) {
		num->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				num->push_back(std::atoi(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		num->push_back(std::atoi(row.c_str()));
	}
	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::Num s;
	AtCoder::input(&s);

	const int num = s[0];

	AtCoder::Str str;
	AtCoder::input(&str);
	AtCoder::exp(&str[0], &str);

	if (1 == num) {
		printf("No\n");
		return 0;
	} else {
		if (0 == num % 2) {
			bool sf = true;
			const int max = num / 2;
			for (int i = 0; i < max; i++) {
				if (str[i] != str[i + max]) {
					sf = false;
					break;
				}
			}
			if (sf) {
				printf("Yes\n");
			} else {
				printf("No\n");

			}
		} else {
			printf("No\n");
		}
	}

	return 0;
}


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

int main() {
  int a, b;
  int count = 0;
  cin >> a >> b;
  for (int i = a; i <= b; i++){
    if (i%10 == i/10000) {
      if ((i/10)%10 == (i/1000)%10) {
	count++;
      }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f
    let readChars() = read string |> Seq.toArray
    let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

[<AutoOpen>]
module Cout =
    let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput()))
    let print (s: string) = writer.Write s
    let println (s: string) = writer.WriteLine s
    let inline puts (s: ^a) = string s |> println

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

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

let main() =
    let [| N; M |] = reada int
    let scs = Array.zeroCreate 5
    for i in 0 .. M - 1 do
        let [| s; c |] = reada int
        let s = s - 1
        scs.[i] <- s, c

    let mutable ans = "-1"
    for i in 1000 .. -1 .. 0 do
        let cand = string i
        let mutable ok = true
        if cand.Length <> N then
            ok <- false
        else
            for m in 0 .. M - 1 do
                let s, c = scs.[m]
                let b = Convert.ToInt32(string cand.[s])
                if b <> c then ok <- false
        if ok then ans <- cand

    puts ans
    ()

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()


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

void make_frame(int h, int w){
  for(int i=0;i<h;i++){
    if(i==0 || i== h-1)
      for(int j=0;j<w;j++) cout<<'#';
    else{
      cout <<"#";
      for(int k=2;k<w;k++) cout<<'.';
      cout <<"#";
    }
    cout<<"\n";
  }
  cout<<"\n";
}
int main(){
  int h,w;
  while(1){
    cin>>h>>w;
    if(h==0 && w==0) break;
    make_frame(h,w);
  }
}

Measured memory_bytes: 3012
import sys
readline = sys.stdin.readline


def solve():
    N = int(input())
    brackets_gen = (readline().strip() for _ in range(N))

    grads_positive = list()
    grads_negative = list()

    total = 0
    for brackets in brackets_gen:

        elevation, bottom = 0, 0

        for bk in brackets:

            elevation += 1 if bk == '(' else -1
            bottom = min(bottom, elevation)

        if elevation >= 0:
            grads_positive.append((bottom, elevation))
        elif elevation < 0:
            grads_negative.append((bottom - elevation, -elevation))

        total += elevation

    if total != 0:
        return False

    grads_positive.sort(reverse=True)
    grads_negative.sort(reverse=True)

    def is_good(grads):
        elevation, bottom = 0, 0
        for grad in grads:
            bottom = elevation + grad[0]
            if bottom < 0:
                return False
            elevation += grad[1]

        return True

    if is_good(grads_positive) and is_good(grads_negative):
        return True
    else:
        return False


def main():
    ok = solve()
    if ok:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 80288
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#define il inline
#define ll long long
#define re register
#define rep(i,s,t) for(re int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(re int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define pt(x) putchar(x)
#define pti(x) printf("%d",x)
#define ptll(x) printf("%lld",x)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
using namespace std;
il int ci(){
	re char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	re int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}
map<int,int> m;
const int mod = 1e9+7;
int main(){
	int n=ci();
	ll ans= 1;
	m[0]= 3;
	rep(i,1,n){
		int a=ci();
		ans= ans*m[a]%mod;
		m[a]--;
		m[a+1]++;
	}
	ptll(ans),pt('\n');
	return 0;
}


Measured memory_bytes: 4864
import java.util.*;
import java.io.PrintWriter;
public class Main{

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[][] arr = new int[n][2];

    long MOD = 998244353;

    public static void main(String[] args){
        new Main().run();
    }

    void run() {
        for (int i=0; i<n; i++) {
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
        }
        Arrays.sort(arr, (a, b) -> (a[0] - b[0]));
        SegTree st = new SegTree(n);

        int[] maxIdx = new int[n];
        for (int i=n-1; 0<=i; i--) {
            int idx = upperbound(i, n, arr[i][0]+arr[i][1]-1);
            maxIdx[i] = Math.max(i, st.query(i+1, idx));
            st.update(i, maxIdx[i]);
        }
        long[] dp = new long[n+1];
        dp[n] = 1;
        for (int i=n-1; 0<=i; i--) {
            dp[i] += dp[i+1] + dp[maxIdx[i]+1];
            dp[i] %= MOD;
        }
        System.out.println(dp[0]);
    }

    int upperbound(int l, int r, int d) {
        while (r - l > 1) {
            int mid = (r + l) / 2;
            if (arr[mid][0] > d) {
                r = mid;
            } else {
                l = mid;
            }
        }
        return r;
    }

    class SegTree {
        int n = 1;
        int[] val;

        public SegTree(int n) {
            while (this.n < n) this.n *= 2;
            val = new int[2*this.n-1];
        }

        void update(int k, int v) {
            k += n - 1;
            val[k] = v;
            while (k > 0) {
                k = (k - 1) / 2;
                val[k] = Math.max(val[2*k+1], val[2*k+2]);
            }
        }

        int query(int a, int b) {
            return query(0, n, a, b, 0);
        }

        int query(int l, int r, int a, int b, int k) {
            if (r<=a || b<=l) return Integer.MIN_VALUE;
            if (a<=l && r<=b) return val[k];
            else {
                int vl = query(l, (l+r)/2, a, b, 2*k+1);
                int vr = query((l+r)/2, r, a, b, 2*k+2);
                return Math.max(vl, vr);
            }

        }
    }
}


Measured memory_bytes: 122716
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();
        long[] a = sc.LongArray();

        long count = a.Where(num => num < 0).Count();

        long[] a2 = a.Select(num => Math.Abs(num)).OrderBy(num => num).ToArray();

        long answer = 0;

        if (a2.Contains(0) || count % 2 == 0)
        {
            answer = a2.Sum();
        }
        else
        {
            answer = a2.Sum() - a2.First() * 2;
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 32340
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 12:33-

            int n = sc.nextInt();
            int x = sc.nextInt();

            int bs = 1;
            int d = 0;
            for (int i = 0; i < n; i++) {
                d += sc.nextInt();
                if (d <= x) bs++;
            }

            out.println(bs);
        }
    }
}


Measured memory_bytes: 23636
def dijkstra_heap(graph: list, s: int, V: int=None):
    """
    :param graph: - adjacency list [(v, w), ...]:
    :param s: start
    :param V: number of vertices
    :return: dist, pred
    """
    import heapq

    pq = []
    INF = float("inf")

    if V is None:
        V = len(graph)

    dist = [INF] * V
    pred = [-1] * V

    dist[s] = 0

    heapq.heappush(pq, (0, s))

    while pq:
        d, u = heapq.heappop(pq)
        if d > dist[u]:
            continue

        for v, w in graph[u]:
            new_dist = dist[u] + w
            if new_dist < dist[v]:
                heapq.heappush(pq, (new_dist, v))
                dist[v] = new_dist
                pred[v] = u
    return dist, pred


def main():
    N, M = [int(x) for x in input().split()]
    graph = [list() for _ in range(N)]
    for _ in range(M):
        a, b = [int(x) for x in input().split()]
        a -= 1
        b -= 1
        graph[a].append((b,1))
        graph[b].append((a,1))
    dist, pred = dijkstra_heap(graph, 0)
    if any(d == float("inf") for d in dist):
        print("No")
    else:
        print("Yes")
        for i in range(1,N):
            print(pred[i]+1)
 
 
if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10000)
    main()

Measured memory_bytes: 64112
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define emb emplace_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define N  99999
#define f first 
#define em emplace
#define s second
using lint=long long int;

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;

 
#define fori(n) for(int i=0; i<int(n); i++)
 
#define cins(s) string s; cin>>s;
#define cini(i) lint i; cin>>i;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }
#define z 1000000007 


void solve(){
  
  cini(n);
  vector<int>dp(3);


  for(int i=0;i<n;i++){
     vector<int>v(3);

     for(int j=0;j<3;j++){
           cin>>v[j];
            int m=0;
           for(int k=0;k<3;k++){

              if(j!=k){
                m=max(dp[k],m);
              }
           }
           v[j]+=m;
     }
    dp.clear();
    v.swap(dp);
  }
     
     int a=*max_element(dp.begin(),dp.end());
     cout<<a<<endl;




}
 
 
int main()
{ 
  fast;




  solve();
 }

Measured memory_bytes: 256
#ifndef _TEMPLATE_ROOT
#define _TEMPLATE_ROOT
#include "bits/stdc++.h"
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define repl(i, a, b) for(ll i = a; i < (b); ++i)
#define repd(i, a, b) for(int i = a; i >= (b); --i)
#define repdl(i, a, b) for(ll i = a; i >= (b); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
#endif
#ifndef _TEMPLATE_IO
#define _TEMPLATE_IO

template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void writef(T ...tail) { write(tail...); cout << flush; }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  if (v.size()) {
    rep(i, 0, sz(v) - 1)
      out << v[i] << " ";
    out << v.back();
  }
  return out;
}
#endif
using namespace std;

int pf[1000005], cnt[1000005];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  rep(i, 2, 1000001) {
    for (int j = i; j <= 1000000; j += i) if (!pf[j]) pf[j] = i;
  }

  int n; read(n);
  int g = 0;
  rep(i, 0, n) {
    int a; read(a);
    g = __gcd(g, a);
    int l = -1;
    while (a > 1) {
      if (l != pf[a]) {
        l = pf[a];
      }
      cnt[l]++;
      while (l == pf[a]) {
        a /= l;
      }
    }
  }
  bool pc = true, sc = true;
  rep(i, 2, 1000001) if (cnt[i] >= 2) pc = false;
  sc = g == 1;
  if (pc) die("pairwise coprime");
  else if (sc) die("setwise coprime");
  else die("not coprime");
}



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

int N;
string S,T,ans;

int main() {
	ios_base::sync_with_stdio(0); 
	cin.tie(0);
	cin >> N >> S >> T;
	int idx = 0, idy = 0;
	for (int i = 0; i < N*2; i++) {
		if (i % 2 == 0) ans += S[idx++];
		else ans += T[idy++];
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
A, B, M = map(int,input().split())

refredge = list(map(int, input().split()))
microwave = list(map(int, input().split()))

costs = []
for i in range(M):
    dis = list(map(int, input().split()))
    cos = (refredge[dis[0]-1] + microwave[dis[1]-1] - dis[2])
    costs.append(cos)
abcost = min(refredge) + min(microwave)
print(min(min(costs), abcost))


Measured memory_bytes: 18736
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
using namespace std;

class UnionFind {
public:
	vector<int> par;

	void init(int sz) {
		par.resize(sz, -1);
	}
	int root(int pos) {
		if (par[pos] == -1) return pos;
		par[pos] = root(par[pos]);
		return par[pos];
	}
	void unite(int u, int v) {
		u = root(u); v = root(v);
		if (u == v) return;
		par[u] = v;
	}
	bool same(int u, int v) {
		if (root(u) == root(v)) return true;
		return false;
	}
};

int N, dp[309][309], dist[309][309];

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) { cin >> dp[i][j]; dist[i][j] = dp[i][j]; }
	}
	for (int k = 1; k <= N; k++) {
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= N; j++) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
		}
	}

	vector<tuple<int, int, int>> tup;
	UnionFind UF; UF.init(N + 2);
	long long ret = 0;

	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			if (dist[i][j] != dp[i][j]) {
				cout << "-1" << endl;
				return 0;
			}
			if (i != j) {
				bool flag = false;
				for (int k = 1; k <= N; k++) {
					if (i == k || j == k) continue;
					if (dp[i][k] + dp[k][j] == dp[i][j]) flag = true;
				}
				if (flag == true) {
					tup.push_back(make_tuple(dist[i][j], i, j));
				}
				else {
					if (i < j) {
						ret += 1LL * dp[i][j];
						UF.unite(i, j);
					}
				}
			}
		}
	}
	sort(tup.begin(), tup.end());

	for (int i = 0; i < tup.size(); i++) {
		int pos1 = get<1>(tup[i]), pos2 = get<2>(tup[i]);
		if (UF.same(pos1, pos2) == false) {
			ret += 1LL * get<0>(tup[i]);
			UF.unite(pos1, pos2);
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 2680
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,d[100],a=1;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>d[i];
    }
    sort(d,d+n,greater<int>());
    for(int i=0;i<n-1;i++){
        if(d[i]>d[i+1])
            a++;
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <cctype>
#include <stack>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <cmath>
//#include <bits/stdc++.h>

using namespace std;
typedef long long lolo;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ulolo;

const int maxn = (int)2e5 + 5;
const int INF = 0x3f3f3f3f;
const lolo inf = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const int MOD = 1000000007;

template<class T>
inline void read(T &x) {
    x = 0; T flag = 1;char c;
    do { c = (char) getchar(); if (c == '-') break; } while (c < '0' || c > '9');
    if (c == '-') { c = '0', flag = -1;}
    do { x = x * 10 + c - '0';c = (char) getchar();} while (c >= '0' && c <= '9');
    x *= flag;
}
template<class T>
inline void out(T x) {
    if (x > 9) out(x / 10);
    x = x % 10;
    putchar('0' + x);
}

int a[maxn], cnt[maxn];
lolo c2(int n) {
    if (n <= 1) {
        return 0;
    }
    return 1LL*n*(n-1)/2;
}
int main() {
//    freopen("../in.txt", "r", stdin);
    int n, m;
    read(n);
    read(m);
    printf("%lld\n", c2(n) + c2(m));
    return 0;
}


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

using ll=long long;

int main()
{
	for(int n;cin>>n && n;){
		vector<int> a(n),b(n);
		for(int i=0;i<n;i++)
			cin>>a[i],b[--a[i]]=i;
		map<int,int> range;
		range[0]=n;
		ll res=0;
		for(int x=0;x<n;x++){
			int i=b[x];
			auto it=--range.upper_bound(i);
			int l=it->first,r=it->second;
			res+=ll(x+1)*(i-l+1)*(r-i);
			range.erase(it);
			if(l<i) range[l]=i;
			if(i+1<r) range[i+1]=r;
		}
		cout<<res<<endl;
	}
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
    double ans=0;
    for(int i=0; i<n; ++i){
        double a; cin >> a;
        ans += 1/a;
    }
    cout << fixed << setprecision(14);
	cout << 1/ans << endl;
}

Measured memory_bytes: 256
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

#　素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# ここから書き始める
# Colorful Leaderboard 
n = int(input())
a = list(map(int, input().split()))
s = [0] * 8
cnt = 0
for i in a:
    if i < 3200:
        s[i // 400] = 1
    else:
        cnt += 1
# print(s)
maximum = sum(s) + cnt
minimum = max(sum(s), 1)
print(minimum, maximum)

# @lru_cache(maxsize=1000)
# def dfs(total, index):
#     if index == n:
#         if total % 10 != 0:
#             return total
#         return 0
#     return max(dfs(total + s[index], index + 1), dfs(total, index + 1))

# n = int(input())
# s = [0] * n
# for i in range(n):
#     s[i] = int(input())
# ans = dfs(0, 0)
# print(ans)


Measured memory_bytes: 63980
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
double ans=1e9;
double eps=1e-9;
double dist(double x,double y,double a,double b){
    return sqrt((x-a)*(x-a)+(y-b)*(y-b));
}
double dist2(double x,double y,double a,double b){
    return ((x-a)*(x-a)+(y-b)*(y-b));
}
struct Niku{
    double x;
    double y;
    double c;
};
void Main(){
    ll n;cin>>n;
    ll k;cin>>k;
    vector<Niku> niku(n);
    For(i,0,n){
        cin>>niku[i].x>>niku[i].y>>niku[i].c;
    }
    if(k==1){
        ans=0;
    }
    else{
        double ok=1e7,ng=0;
        while(ok-ng>1e-10){
            double mid=(ok+ng)/2;
            bool flag=false;
            For(i,0,n){
                ll cnt=0;
                For(j,0,n){
                    if(dist(niku[i].x,niku[i].y,niku[j].x,niku[j].y)<=mid/niku[j].c+eps) cnt++;
                }
                if(cnt>=k){
                    flag=true;
                    goto next;
                }
                For(j,i+1,n){
                    double r1=mid/niku[i].c;
                    double r2=mid/niku[j].c;
                    double D=dist(niku[i].x,niku[i].y,niku[j].x,niku[j].y);
                    if(D>r1+r2||r1>D+r2||r2>D+r1) continue;
                    double x1=(niku[j].x-niku[i].x),y1=(niku[j].y-niku[i].y);
                    double x2y2=x1*x1+y1*y1;
                    double a=(x2y2+r1*r1-r2*r2)/2/D;
                    double h=sqrt(r1*r1-a*a);
                    For(t,0,2){
                        double X=niku[i].x+a*x1/D,Y=niku[i].y+a*y1/D;
                        if(t==0){
                            X+=h*y1/D;
                            Y-=h*x1/D;
                        }
                        else{
                            X-=h*y1/D;
                            Y+=h*x1/D;
                        }
                        cnt=0;
                        For(i2,0,n){
                            if(dist(niku[i2].x,niku[i2].y,X,Y)<=mid/niku[i2].c+eps){
                                cnt++;
                            }
                        }
                        if(cnt>=k){
                            flag=true;
                            goto next;
                        }
                    }
                }
            }
            next:;
            if(flag) ok=mid;
            else ng=mid;
        }
        ans=ok;
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
}
int main(){
    Main();
    return 0;
}

Measured memory_bytes: 256
# B 
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
a=nl()
a=[x%2 for x in a]
if sum(a)%2==0:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 14104
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        n: usize,
        towns: [(f64, f64); n],
    }
    let dis = |a: (f64, f64), b: (f64, f64)| -> f64 {
        ((a.0 - b.0).powf(2.0) + (a.1 - b.1).powf(2.0 )).sqrt()
    };
    let mut sum = 0.0;
    for i in 0..n {
        for j in 0..n {
            if i == j { continue; }
            sum += dis(towns[i], towns[j]);
        }
    }
    println!("{:.10}", sum / n as f64);
}


Measured memory_bytes: 4352