akhauriyash/Code-Regression huggingface dataset:
N, K, Q = map(int, input().split())
A_lis = [int(input()) for _ in range(Q)]
#A_lis.sort()

B_lis = [int(K-Q)]*N
for A in A_lis:
    B_lis[A-1]+=1
for B in B_lis:
    if B>0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 10472
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

using t = std::tuple<ll, ll, ll, ll>;

int main() {
	IOS();
	ll x, y, z, k;
	cin >> x >> y >> z >> k;
	vector<ll> a(x), b(y), c(z);
	for (int i = 0; i < x; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < y; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < z; i++) {
		cin >> c[i];
	}
	sort(a.begin(), a.end(), greater<ll>());
	sort(b.begin(), b.end(), greater<ll>());
	sort(c.begin(), c.end(), greater<ll>());
	priority_queue<t> que;
	set<t> s;
	que.emplace(a[0] + b[0] + c[0], 0, 0, 0);
	for (int i = 0; i < k; i++) {
		t tmp = que.top();
		dump(get<0>(tmp));
		que.pop();
		ll sum = get<0>(tmp), ax = get<1>(tmp), bx = get<2>(tmp), cx = get<3>(tmp);
		if (ax + 1 < x) {
			t tmp1 = make_tuple(sum + a[ax + 1] - a[ax], ax + 1, bx, cx);
			if (s.find(tmp1) == s.end()) {
				que.push(tmp1);
				s.insert(tmp1);
			}
		}
		if (bx + 1 < y) {
			t tmp2 = make_tuple(sum + b[bx + 1] - b[bx], ax, bx + 1, cx);
			if (s.find(tmp2) == s.end()) {
				que.push(tmp2);
				s.insert(tmp2);
			}
		}
		if (cx + 1 < z) {
			t tmp3 = make_tuple(sum + c[cx + 1] - c[cx], ax, bx, cx + 1);
			if (s.find(tmp3) == s.end()) {
				que.push(tmp3);
				s.insert(tmp3);
			}
		}
	}
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

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

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

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


int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  ll X,K,D;
  cin >> X >> K >> D;
  X=abs(X);

  if(X/D>=K)  cout << X-D*K << endl;
  else{
    if((K-X/D)%2==0)  cout << X-(X/D*D) << endl;
    else  cout << abs(X-(X/D*D)-D) << endl;
  }

  return 0;
}

Measured memory_bytes: 3656
a, b, h, m = gets.split().map(&:to_i)

l = (h * 60 + m) * 0.5
s = m * 6

ang = [l,s].max - [l,s].min

puts (a**2 + b**2 - 2*a*b*Math.cos(ang/180.0 * Math::PI))**0.5

Measured memory_bytes: 14884
#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt
#include <sstream>	//stringstream,getline
#include <cmath>	//ceil,M_PI

using namespace std;

int main() {

	string S, T;
	cin >> S >> T;

	T.pop_back();
	if (S == T) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;

}

Measured memory_bytes: 3632
N = int(input())
H = list(map(int, input().split()))

cnt = 0
ans = 0

for i in range(N-1):    
    if H[i] >= H[i+1]:
        cnt += 1
    else:
        if cnt > ans:
            ans = cnt
        cnt = 0
            
if cnt > ans:
    ans = cnt    
        
print(ans)

Measured memory_bytes: 14252
N, M= map(int, input().split())
l = 0
r = N
L = [0] * M
R = [0] * M
for i in range(M):
    L, R = map(int, input().split())
    l = max(l,L)
    r = min(r,R)


if r-l+1 < 0:
    print(0)
else:
    print(r-l+1)

Measured memory_bytes: 43852
import java.io.InputStream
import java.io.PrintStream

import scala.io.Source

case class Dice(numbers: Seq[Int])

sealed trait Command
object N extends Command
object E extends Command
object W extends Command
object S extends Command

case class DiceState(
    top: Int = 0,
    south: Int = 1,
    east: Int = 2,
    west: Int = 3,
    north: Int = 4,
    bottom: Int = 5) {

  def runCommand(command: Command): DiceState = command match {
    case N => copy(top = south, south = bottom, bottom = north, north = top)
    case E => copy(top = west, west = bottom, bottom = east, east = top)
    case W => copy(top = east, east = bottom, bottom = west, west = top)
    case S => copy(top = north, north = bottom, bottom = south, south = top)
  }
}

object Main {

  def run(in: InputStream, out: PrintStream): Unit = {
    val (dice, commands) = input(in)
    val state = commands.foldLeft(new DiceState())((s, c) => s.runCommand(c))
    out.println(dice.numbers(state.top))
  }

  private def input(in: InputStream): Tuple2[Dice, Seq[Command]] = {
    val lines = Source.fromInputStream(in).getLines()
    val dice = toDice(nextLine(lines, "??????????????¢?????°"))
    val commands = toCommands(nextLine(lines, "??????"))
    return (dice, commands)
  }

  private def toDice(line: String): Dice = {
    val numbers = line.split(' ')
    if (numbers.length != 6) {
      throw new IllegalArgumentException(s"??????????????¢?????°????????£??§???: $line");
    }

    return new Dice(numbers.map(_.toInt))
  }

  private def toCommands(line: String): Seq[Command] = {
    return line.map(toCommand)
  }

  private def toCommand(char: Char): Command = char match {
    case 'N' => N
    case 'E' => E
    case 'W' => W
    case 'S' => S
    case _ => throw new IllegalArgumentException(s"?????????????????????????????§???: ${char}")
  }

  def nextLine(lines: Iterator[String], label: String): String = {
    if (!lines.hasNext) {
      throw new IllegalArgumentException(s"${label}??????????????\????????????????????????")
    }
    return lines.next()
  }

  def main(args: Array[String]): Unit = {
    try {
      run(System.in, System.out)
    } catch {
      case e: Exception => {
        System.err.println(s"??¨??????: ${e.getMessage()}")
        e.printStackTrace()
      }
    }
  }
}

Measured memory_bytes: 44176
#include <stdio.h>
#define N 100
int main(){
  int flag=1,n,num=0;
  int i,k,A[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  while(flag){
    flag=0;
    for(i=n-1;i>=1;i--){
      if(A[i]<A[i-1]){
	k=A[i];
	A[i]=A[i-1];
	A[i-1]=k;
	flag=1;
	num++;
      }
    }
  }
  for(i=0;i<n;i++){
    if(i==n-1){
printf("%d",A[i]);
 continue;
    }
    printf("%d ",A[i]);
  }
  printf("\n%d\n",num);
  return 0;
}



Measured memory_bytes: 2144
module Main where

    import Debug.Trace
    import Data.Ord
    
    solve :: Int -> Int -> String
    solve a b = case compare a b of
        LT -> "a < b"
        GT -> "a > b"
        EQ -> "a == b"
    
    readLine:: IO [Int]
    readLine = fmap (map read . words) getLine
    
    main :: IO() 
    main = do
        [a, b] <- readLine
        let ans = solve a b
        putStrLn ans
    


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

vector<int> res;
void perm_mult(vector<int> &P1, vector<int> &P2)
{
  int i;
  std::vector<int> v;
  for(i=0;i<P1.size(); i++)
  {
    v.push_back(P1[P2[i]]);
  }
  for(i=0;i<P1.size(); i++)
  {
    P1[i] = v[i];
  }
}
void Permuation_exponentiation(vector<int> &P, int n, long long K)
{
  int i;
  for(i=0;i<n;i++)
    res.emplace_back(i);

  while(K!=0)
  {
    if(K&1)
    {
      perm_mult(res, P);
    }
    perm_mult(P, P);
    K = K >> 1;
  }
}
int main()
{
  int N;
  cin >> N;
  map<int, int> mp;
  std::vector<int> v;
  int i,j, x[100000], a[100000];

  for(i=0;i<N;i++)
    cin >> x[i];

  long long M, K;
  cin >> M>>K;

  for(i=0;i<M;i++)
  {
    cin >> a[i];
    a[i]-=2;
  }

  int k = 0;
  for(i=1;i<N;i++)
  {
    v.push_back(i-1);
    mp[k++]=x[i]-x[i-1];
  //  cout<<v[k-1]<<" "<<k<<endl;
  }
//cout<<endl;
  for(i=0;i<M;i++){
    //cout<<i<< " "<<v[a[i]]<<v[a[i]+1]<<endl;
    swap(v[a[i]], v[a[i]+1]);
  }

  Permuation_exponentiation(v, v.size(), K);
  cout<<x[0]<<endl;
  long long prev = x[0];
  for(i=1;i<N-1;i++)
  {
    int d = mp[res[i-1]];
    cout<< prev+d<<endl;
    prev = prev+d;
  }
  cout<<x[N-1]<<endl;
}


Measured memory_bytes: 10312
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = LLONG_MAX;

/*
<url:https://abc075.contest.atcoder.jp/tasks/abc075_d>
問題文============================================================
 2次元座標上に N 個の点があります。
 i(1≦i≦N) 番目の点の座標は (xi,yi) です。
 長方形の内部に N 点のうち K 個以上の点を含みつつ、それぞれの辺がX軸かY軸に平行な長方形を考えます。
 このとき、長方形の辺上の点は長方形の内部に含みます。
 それらの長方形の中で、最小の面積となるような長方形の面積を求めてください。
=================================================================

解説=============================================================

 長方形の右上と左下の角が頂点となり得るx、y値（全頂点のx,yの値）
 で全探索、
 
 O(N^4 * N)
 
 N(<=50)から50^4 * 50 ~ 10^7
 間に合う
 
================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N,K; cin >> N >> K;
    vector<pll> ps(N);
    vector<ll> X(N),Y(N);
    for(int i = 0; i < N;i++){
        cin >> ps[i].first >> ps[i].second;
        X[i] = ps[i].first; Y[i] = ps[i].second;
    }
    sort(X.begin(),X.end()); sort(Y.begin(),Y.end());
    
    ll ans = LINF;
    for(int xi = 0; xi < N; xi++){
        for(int xj = xi + 1; xj < N; xj++){
            for(int yi = 0; yi < N; yi++){
                for(int yj = 0; yj < N; yj++){
                    
                    int cnt = 0;
                    ll minx = X[xi], miny = Y[yi];
                    ll maxx = X[xj], maxy = Y[yj];
                    for(int k = 0; k < N;k++){
                        if(minx <= ps[k].first &&
                           ps[k].first <= maxx &&
                           miny <= ps[k].second &&
                           ps[k].second <= maxy)
                            cnt++;
                    }
                    if(cnt >= K){
                        ans = min(ans,(maxx-minx)*(maxy-miny));
                    }
                }
            }
        }
    }

    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())

cnt = 0
for i in range(1, N + 1):
    if i % 2 != 0:
        divisor = 0
        for j in range(1, i + 1):
            if i % j == 0:
                divisor += 1
        if divisor == 8:
            cnt += 1

print(cnt)


Measured memory_bytes: 2940
#include<stdio.h>
int main()
{
    int i,N,count=1,max;
    scanf("%d",&N);
    int ara[N];
    for(i=0;i<N;i++)
    {
        scanf("%d",&ara[i]);
    }
    max=ara[0];
    for(i=1;i<N;i++)
    {
        if(ara[i]<max)
        {
            max=ara[i];
            count++;
        }
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 2508
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#define per(i,a,n) for(int i=a;i<=n;i++)
using namespace std;
vector<int>st;
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int a[100]={0,1,1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;cin>>k;
    cout<<a[k];
    return 0;
}


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

class Program {
    internal static void Main(string[] args) {
        var inp = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var N = inp[0];
        var M = inp[1];
        var ab = new List<int[]>();

        for (int i = 0; i < M; i++) {
            var tmp = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            ab.Add(new int[] { tmp[0], tmp[1] });
        }

        ab = ab.OrderBy(hoge => hoge[1]).ToList();
        var bef = ab[0][1] - 1;
        var ans = 1;
        foreach (var i in ab) {
            if (bef < i[0]) {
                bef = i[1] - 1;
                ans++;
            }
        }

        WriteLine(ans);
    }

}

Measured memory_bytes: 28596
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{

	ll x,n;
	cin>>x>>n;
	ll i;
	ll arr[n];
	for(i=0; i<n; i++)
		cin>>arr[i];
	ll j;
	ll ans;
	for(j=0; j<=1000; j++)
	{ 
		ll flagp=0; ll flagq=0;
		ll val1=x-j;
		ll val2=x+j;
     // cout<<val1<<" "<<val2<<'\n';
      for(i=0; i<n; i++)
      {
        if(arr[i]==val1)
        {   
        	flagp=1;
        }
         if(arr[i]==val2)
        {
        	flagq=1;
        }
      }
      if(flagp==0)
      	{
          ans=val1;
          break;
      	}
      if(flagq==0)
      	{
      		ans=val2;
      		break;
      	}
	}
	cout<<ans;
	return 0;
}

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

import math

def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = max(a)
    a.remove(m)

    ans = m
    h = m / 2
    dif = 9999999999
    for num in a:
        if abs(h - num) < dif:
            ans = num
            dif = abs(h - num)

    print(m)
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14180
#include<bits/stdc++.h>
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ull unsigned long long
#define lli long long int
#define pb push_back
#define all(x) x.begin(),x.end()
ll mob=1000000007;
using namespace std;
int main()
{ 
 
string h;
cin>>h;
int u=h.length();
int dp[u+1];
dp[u]=0;
int ten =1;
for(int i=u-1;i>=0;i--)
{
  int a=((h[i]-'0')*ten)%2019;
  dp[i]=(dp[i+1]+a)%2019;
  ten*=10;ten=ten%2019;
}
vector<int> cnt(2019,0);
int ans =0;
for(int i=u;i>=0;i--)
{
  ans+=cnt[dp[i]];
  cnt[dp[i]]++;
}
 
 
cout<<ans;
 
return 0;
}

Measured memory_bytes: 4468
N,K,*L = map(int, open(0).read().split())
ls = []
for i,(t,d) in enumerate(zip(*[iter(L)]*2)):
  ls.append((d,t))
ls.sort()
S = set()
pre = []
ans = 0
num = 0
for i in range(K):
  d,t = ls.pop()
  ans += d
  if t not in S:
    num += 1
    S.add(t)
  else:
    pre.append(d)
pre.sort(reverse=True)
ans += num*num
if pre==[]:
  print(ans)
  exit()
m = ans
for i in range(N-K):
  d,t = ls.pop()
  if t in S:
    continue
  S.add(t)
  m -=pre.pop()
  m += d+2*num+1
  num += 1
  ans = max(ans,m)
  if pre==[]:
    break
print(ans)

Measured memory_bytes: 25940
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, k, a, b;
vector<int> vec1[100010], t;
int parent[100010], visit[100010];
bool used[100010];
int co[100010];
void dfs(int node) {
	used[node] = true;
	t.push_back(node);
	for (int i : vec1[node]) {
		if (!used[i]) {
			dfs(i);
			co[node]++;
			parent[i] = node;
		}
	}
}
signed main() {
	cin >> n >> k;
	rep(i, n - 1) {
		cin >> a >> b;
		vec1[a].push_back(b);
		vec1[b].push_back(a);
	}
	dfs(1);
	int ans = 1;
	REP(i, n) {
		if (i == 1)ans *= k;
		else if (parent[i] == 1) {
			ans *= k - visit[parent[i]] - 1;
			visit[parent[i]]++;
		}
		else {
			ans *= k - visit[parent[i]] - 2;
			visit[parent[i]]++;
		}
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

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

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

    int N, M, C; cin >> N >> M >> C;
    vector<int> B(M);
    for (int i = 0; i < M; i++) cin >> B[i];
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int res = 0;
        for (int j = 0; j < M; j++) {
            int A; cin >> A;
            res += A * B[j];
        }
        if (res + C > 0) ans++;
    }
    cout << ans << "\n";
}

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

int main(){
    
    string S;
    cin >> S;
    int answer = 1000;
    for(int i = 0;i < S.size();++i){
        string a = S.substr(i,3);
        answer = min(answer,abs(stoi(a)-753));
    }
    cout << answer << endl;
}

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

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        int n = Integer.parseInt(line);
        n = n*n*n;
        System.out.println(n);
    }
}


Measured memory_bytes: 24252
def main():
  import sys
  n,s,_,*t=sys.stdin.buffer.read().split()
  n=int(n)
  d=[0]*n+[1<<c-97for c in s]
  for i in range(n-1,0,-1):d[i]=d[i+i]|d[i+i+1]
  r=[]
  for q,a,b in zip(*[iter(t)]*3):
    i,s=int(a)+n-1,0
    if q<b'2':
      d[i]=1<<b[0]-97
      while i>1:
        i//=2
        d[i]=d[i+i]|d[i+i+1]
      continue
    j=int(b)+n
    while i<j:
      if i&1:
        s|=d[i]
        i+=1
      if j&1:
        j-=1
        s|=d[j]
      i//=2
      j//=2
    r+=bin(s).count('1'),
  print(' '.join(map(str,r)))
main()

Measured memory_bytes: 45552
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;


public class Main {

	private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1);

	private String inputData = null;

	public String[] data = null;

	public short num = 0;

	public short count = 0;

	public HashMap<Short, Short> humanData = new HashMap<Short, Short>();

	public ArrayList<Short> topId = new ArrayList<Short>();

	public ArrayList<Short> topLength = new ArrayList<Short>();

	public static void main(String[] args) {
		new Main().start();
		System.exit(0);
	}

	public void start() {
		while (true) {
			try {
				this.inputData = reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}

			this.data = this.inputData.split(" ");

			if (this.data.length == 1) {
				if (this.data[0].equals("0")) {
					break;
				}
				try {
					this.num = Short.parseShort(this.data[0]);
				} catch (Exception e) {
					continue;
				}

			}

			this.humanData.clear();

			for (int i = 0; i < this.num; i++) {
				try {
					this.inputData = reader.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (this.inputData != null) {
					this.data = this.inputData.split(" ");
				}

				this.humanData.put(Short.parseShort(data[0]),
						(short) (Short.parseShort(data[1]) + Short.parseShort(data[2])));

			}

			Iterator<Short> itId = this.humanData.keySet().iterator();
			int numCount = 0;
			while (itId.hasNext()) {
				short id = itId.next();
				if (numCount == 0) {
					this.topId.add(id);
					this.topLength.add(this.humanData.get(id));
				} else {
					if (this.topLength.get(count) <= this.humanData.get(id)) {
						this.topId.set(this.count, id);
						this.topLength.set(this.count, this.humanData.get(id));
					}
				}
				numCount++;
			}

			this.count++;

		}

		for (int i = 0; i < this.topId.size(); i++) {
			System.out.println(this.topId.get(i) + " " + this.topLength.get(i));
		}

	}

}

Measured memory_bytes: 102084
#include "bits/stdc++.h"

using namespace std;
using VI = vector<int>;
using VPI = vector<pair<int, int>>;
using LL = long long;

#define FOR(a,n) for(int i=a;i<n;i++)
#define rFOR(a,n) for(int i=n-1;i>=a;i--)
#define IN(n,a) for(int i=0;i<n;i++) cin>>a[i]
#define pIN(n,t) for(int i=0;i<n;i++){int a,b; cin>>a>>b; t.emplace_back(a,b);}
#define SORT(a) sort(a.begin(), a.end())
#define ALL(a) a.begin(), a.end()

int main()
{
	char s;
	cin >> s;
	s++;
	cout << s;
}

Measured memory_bytes: 256
use std::collections::BTreeSet;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let m: usize = sc.read();
    let mut dag = vec![BTreeSet::new(); n];
    let mut inv_dag = vec![BTreeSet::new(); n];
    for _ in 0..m {
        let s = sc.read::<usize>() - 1;
        let t = sc.read::<usize>() - 1;
        dag[s].insert(t);
        inv_dag[t].insert(s);
    }

    let dp = calc(&dag, &inv_dag);
    let mut ans = dp[0];
    for from in 0..n {
        if dag[from].len() <= 1 {
            continue;
        }
        if let Some(&next) = dag[from]
            .iter()
            .max_by(|&&next_a, &&next_b| dp[next_a].partial_cmp(&dp[next_b]).unwrap())
        {
            dag[from].remove(&next);
            inv_dag[next].remove(&from);

            ans = ans.min(calc(&dag, &inv_dag)[0]);

            dag[from].insert(next);
            inv_dag[next].insert(from);
        }
    }

    println!("{}", ans);
}

fn calc(dag: &Vec<BTreeSet<usize>>, inv_dag: &Vec<BTreeSet<usize>>) -> Vec<f64> {
    let n = dag.len();
    let mut dp = vec![0.0; n];
    for i in (1..n).rev() {
        let cur = dp[i];
        let next = cur + 1.0;
        for &prev in inv_dag[i].iter() {
            dp[prev] += next / (dag[prev].len() as f64);
        }
    }
    dp
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 10492
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int k[] = new int[N];
		int s[] = new int[M];
		int v[] = new int[N];
		for(int j = 0; j < N; j++){
			k[j] = sc.nextInt();
		  }
		for(int j = 0; j < M; j++){
			s[j] = sc.nextInt();
		  }
		for(int i = 0; i < M; i++){
			for(int j = 0; j < N; j++){
				if(k[j] <= s[i]){
					v[j]++;
					break;
					}
				}
			}
		int  max = 0;
		for(int i = 0; i < N; i++){
			if(v[max] < v[i]){
				max = i;
				}
			}
		System.out.println(max + 1);
		}
	}

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

int main(void){
  int N,i;
  long long int p = 1;
  scanf("%d",&N);
   
  for(i=1; i <= N;i++){
    p = p * i;
    p = p % 1000000007;
    }
    
   printf("%lld\n",p);

  return 0;
    
 }

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    ll N,A,B,ans,big,small,ans1,ans2;
  cin >> N>>A>>B;
  
  if((A-B)%2==0){
  ans=abs((A-B)/2);
  }
  else {
    if(A>B){big=A;small=B;}
    if(A<B){big=B;small=A;}
    ans1=(N-big+1)+(N-(small+N-big+1))/2;
    ans2=(small)+(big-1-small)/2;
    ans=min(ans1,ans2);
  }
   cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
public class Main{
	static ArrayList<Integer>[] uu;
	static int[] c;
	static boolean[][] used;
	static long ans=0;
	static int[] aa;
	static int nn;
	static int n;
	static boolean ct;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		uu=new ArrayList[n];
		used=new boolean[n][n];
		aa=new int[n];
		nn=0;
		for(int i=0; i<n; i++){
			uu[i]=new ArrayList<>();
		}
		for(int i=1; i<n; i++){
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			uu[a].add(b);
			uu[b].add(a);
		}
		c=new int[n];
		for(int i=0; i<n; i++){
			c[i]=sc.nextInt();
		}
		Arrays.sort(c);
		dfs(-1,0,0);
		System.out.println(ans);
		for(int i=0; i<n; i++){
			System.out.println(aa[i]);
		}
	}
	static void dfs(int front ,int now,int nnn){
		if(nn>n-1){
			return;
		}
		aa[now]=c[n-1-nn];
		if(front!=-1){
			ans+=Math.min(c[nnn],c[nn]);
		}
		for(int i:uu[now]){
			if(!used[now][i]){
				used[i][now]=true;
				nn++;
				dfs(now,i,nn-1);
			}
		}
		return;
	}
}


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

int main() {
    double n; cin >> n;
    for(int i= n; i > 0; i --) {
        int j = sqrt(n);
        if(i==pow(j,2)) {
            cout << i << endl;
            return 0;
        }
    }
}

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


Measured memory_bytes: 2028
#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( void )
{
	ll n, k;
	cin >> n >> k;

	ll now = 1;
	while ( n-- ) {
		now = min(now * 2, now + k);
	}

	cout << now << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int numofinput;
	int input[100];
	
	scanf("%d", &numofinput);
	
	for(int i = 0; i < numofinput; i++){
		scanf("%d", &input[i]);
	}
	
	for(int rev = numofinput - 1; rev >= 0; rev--){
		printf("%d", input[rev]);
		if(rev == 0) break;
		printf(" ");
	}
	putchar('\n');
	
}


Measured memory_bytes: 2056
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>

using namespace std;

using ll = long long;

#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--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int main() {
  ll input(n);
  vector<ll> a(n);
  vector<ll> cnt(100000 + 1);
  REP(i, n) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  ll input(q);

  ll ans = accumulate(a.begin(), a.end(), 0ll);
  REP(i, q) {
    ll input(b, c);
    ans = ans - (cnt[b] * b) + (cnt[b] * c);
    cnt[c] += cnt[b];
    cnt[b] = 0;

    cout << ans << endl;
  }
}


Measured memory_bytes: 4740
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<class T>//ex) auto dp = make_vec(4,4,4,INF);
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}


int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	string S;
	cin >> S;

	auto dp = make_vec(N + 1, 4, 1000, 0);//dp[i+1][j][k]:i文字目まで見てj文字確定したときの文字列kが実現できるなら1
	dp[0][0][0] = 1;

	for (Int i = 0; i < N; i++) {
		for (Int j = 0; j < 3; j++) {
			for (Int k = 0; k < 100; k++) {
				if (dp[i][j][k]==0) {
					continue;
				}
				//i文字目を選択する場合
				dp[i + 1][j + 1][10 * k + (S[i] - '0')] = 1;
			
				//i文字目を選択しない場合
				dp[i + 1][j][k] = 1;
			}
		}
	}

	Int ans = 0;
	vector<bool> seen(1000,false);
	for (Int i = 1; i <= N; i++) {
		for (Int k = 0; k < 1000; k++) {
			if (dp[i][3][k]) {
				if (seen[k]) {
					continue;
				}
				ans++;
				seen[k] = true;
			}
		}
	}
	cout << ans << "\n";

}


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

int main() {
  string S;
  cin >> S;
  int count = 0, Max = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == 'A' || S.at(i) == 'T' || S.at(i) == 'G' || S.at(i) == 'C') {
      count++;
    } else {
      if (count > Max) {
        Max = count;
      }
      count = 0;
    }
  }
  cout << max(count,Max) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cstdio>
#include <stdio.h> 
#include <map>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int n;
	cin>>n;
	for (int i=1; i<=9; i++) {
		for (int j=1; j<=9; j++) {
			if(i*j==n) {
				cout << "Yes";
				return 0;
			}
		}
	}
	cout << "No";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,K;
    cin >> N >> K;
    vector<int> men(N);
    int count = 0;
    for (int i = 0;i < N;i++){
        cin >> men.at(i);
    }
    for (int i = 0;i < N;i++){
        if (men.at(i) >= K){
            count++;
        }
    }
  	cout << count << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

/*#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;*/

int n;
ll a[200010];
ll oddsuf[200010];
ll dp[200010];
const ll inf = 1LL<<60;

int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    cin >> n;
    Forn(i, n) cin >> a[i];
    ll nowsum = 0;
    for(int i = 1; i<=n; i+=2)
    {
        nowsum += a[n+1-i];
        oddsuf[i] = nowsum;
    }
    dp[2] = max(a[n], a[n-1]);
    for(int i=3; i<=n; i++)
    {
        ll ans = -inf;
        if(i%2 == 0)
        {
            ans = max(ans, a[n-i+1] + dp[i-2]);
            ans = max(ans, a[n-i+2] + oddsuf[i-3]);
        }
        else
        {
            ans = max(ans, a[n-i+1] + dp[i-2]);
            ans = max(ans, a[n-i+2] + dp[i-3]);
            ans = max(ans, oddsuf[i-2]);
        }
        dp[i] = ans;
    }
    cout << dp[n] << endl;
}


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

public class UnionFind
{
    private int[] data;
    public UnionFind(int size)
    {
        data = new int[size];
        for (int i = 0; i < size; i++) data[i] = -1;
    }
    public bool Unite(int x, int y)
    {
        x = Root(x);
        y = Root(y);
        if (x != y)
        {
            if (data[y] < data[x])
            {
                var tmp = y;
                y = x;
                x = tmp;
            }
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    public bool IsSameGroup(int x, int y) => Root(x) == Root(y);
    public int Root(int x) => data[x] < 0 ? x : data[x] = Root(data[x]);
    public int getMem(int x) => -data[Root(x)];
}

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var uf = new UnionFind(n + 10);
        for (int i = 0; i < m; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]) - 1;
            var b = int.Parse(line[1]) - 1;
            uf.Unite(a, b);
        }
        var hs = new HashSet<int>();
        for (int i = 0; i < n; i++) hs.Add(uf.Root(i));
        Console.WriteLine(hs.Count() - 1);
    }
}


Measured memory_bytes: 41908
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
using namespace std;

const int N = 100001;
long long a[N];
long long b[N];

int main()
{
    int n;
    cin >> n;
    for (int i=0; i < n+1; ++i) cin >> a[i];
    for (int i=0; i < n; ++i) cin >> b[i];

    long long ans = 0;
    for (int i=n-1; i>=0; --i) {
        long long x = min(b[i], a[i+1]);
        b[i] -= x;
        long long y = min(b[i], a[i]);
        a[i] -= y;
        ans += x + y;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
typedef long long ll;

int n;
int rest;

int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout.tie(0);
	cin >> n;
	for (int i = 1; i <= 10; i++)
	{
		if (i * 1000 >= n)
		{
			rest = i * 1000 - n;
			goto end;
		}
	}
	end: cout << rest << endl;
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main(){
  int coin[] = {10, 50, 100, 500}, posses[4], pay[4], amount, payment, change, i;
  bool insertEmptyLine = false;
  while(cin >> payment, payment != 0){
    if(insertEmptyLine == true)
      cout << endl;
    insertEmptyLine = true;
    for(i = 0; i < 4; i++)
      cin >> posses[i];
    for(i = 0, amount = 0; i < 4; i++)
      amount += posses[i] * coin[i];
    change = amount - payment;
    for(i = 3; i >= 0; i--){
      pay[i] = posses[i] - change / coin[i];
      change %= coin[i];
    }
    for(i = 0; i < 4; i++)
      if(pay[i] > 0)
	cout << coin[i] << " " << pay[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 864
using System;

namespace ConsoleApp2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int n, m;

            var buf = Console.ReadLine().Split(' ');
            n = int.Parse(buf[0]);
            m = int.Parse(buf[1]);

            int count = 0;
            count += n * (n - 1) / 2;
            count += m * (m - 1) / 2;

            Console.WriteLine(count);
        }
    }
}


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

int main() {
    int R,G,B,N,ans=0;
    cin>>R>>G>>B>>N;
    for(int r=0; r<=N/R; r++) {
        for(int g=0; g<=N/G; g++) {
            int num = N - (R * r) - (G * g);
            if(num % B == 0 && num >= 0) {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3520
#include <stdio.h>

int main(){
    int x[3];
    scanf( "%d %d %d",&x[0],&x[1],&x[2] );

    if( x[0] < x[1] && x[1] < x[2] ) printf( "Yes\n" );
    else printf( "No\n" );
    return 0;
}

Measured memory_bytes: 1008
#include <cstdio>

int main(){
  int N; scanf("%d", &N);

  long long A, B; scanf("%lld%lld", &A, &B);

  for(int i = 1; i < N; i++){
    int X, Y; scanf("%d%d", &X, &Y);
    // Xa >= A, Ya >= B
    // a >= A / X, a >= B / Y
    long long Xa = A / X, Ya = B / Y;
    if(X * Xa < A) Xa++;
    if(Y * Ya < B) Ya++;

    long long a = (Xa > Ya ? Xa : Ya);

    A = X * a; B = Y * a;
  }

  printf("%lld\n", A + B);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  if( a < b )
    {
      if( b < c )
	{ printf("Yes\n");
    }
      else
	{ printf("No\n");
	}
    }
  else
    { printf("No\n");
    }
  return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int k, s;
  cin >> k >> s;
  int ans = 0;
  for(int x = 0; x <= k; ++x){
    for(int y = 0; y <= k; ++y){
      int diff = s - x - y;
      if(diff >= 0 && diff <= k) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long f(long long X, int N, vector<long long> &cnt1, vector<long long> &cnt2){
  if (N == 0){
    return 1;
  } else if (X == 1){
    return 0;
  } else if (X <= cnt1[N - 1] + 1){
    return f(X - 1, N - 1, cnt1, cnt2);
  } else if (X <= cnt1[N - 1] + 2){
    return cnt2[N - 1] + 1;
  } else if (X <= cnt1[N - 1] * 2 + 2){
    return cnt2[N - 1] + 1 + f(X - cnt1[N - 1] - 2, N - 1, cnt1, cnt2);
  } else {
    return cnt2[N];
  }
}
int main(){
  int N;
  long long X;
  cin >> N >> X;
  vector<long long> cnt(N + 1, 1);
  for (int i = 1; i <= N; i++){
    cnt[i] = cnt[i - 1] * 2 + 3;
  }
  vector<long long> cnt2(N + 1, 1);
  for (int i = 1; i <= N; i++){
    cnt2[i] = cnt2[i - 1] * 2 + 1;
  }
  cout << f(X, N, cnt, cnt2);
}

Measured memory_bytes: 3596
#include<stdio.h>
#include<stdlib.h>
#define MAX 10001
#define QMAX 100000

typedef struct cell{
 int num;
 struct cell *parent;
}cell;



void merge(int x,int y,int rank[],cell S[]){
if(x!=y){
if(rank[x]>rank[y]){S[y].parent=&S[x];}
else{S[y].parent=&S[x];
     if(rank[x]==rank[y]){rank[x]++;}
         }
}






return;
}




int findSet(cell S[],int x){
cell *p=S[x].parent;

if(p==NULL){return x;}
else{
 while(p->parent!=NULL){
 p=p->parent;
 }
 return p->num;
}

}








int main(){
int n,i,com,x,y,q;
cell S[MAX];
int rank[MAX]={0};
int C[QMAX];

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

for(i=0;i<q;i++)C[i]=-1;


for(i=0;i<n;i++){
 S[i].num=i;
 S[i].parent=NULL;
}

for(i=0;i<q;i++){
 scanf("%d",&com);
 scanf("%d %d",&x,&y);

 switch(com){

  case 0:x=findSet(S,x);
         y=findSet(S,y);
         merge(x,y,rank,S);
         break;

  case 1:x=findSet(S,x);
         y=findSet(S,y);
         if(x==y){C[i]=1;}
         else{C[i]=0;}
         break;
 }


}/*for終わり*/


for(i=0;i<q;i++){
 if(C[i]!=-1){
  printf("%d\n",C[i]);
 }
}

return 0;
}


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

namespace _1624
{
	class Program
	{
		static void Main(string[] args)
		{
			while (true)
			{
				int n = int.Parse(Console.ReadLine());
				if (n == 0) break;
				long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray();
				int ret = 0;
				for (int i = 0; i < n; i++)
				{
					if (x[i] * n <= x.Sum()) ret++;
				}
				Console.WriteLine(ret);
			}
		}
	}
}



Measured memory_bytes: 17996
x, n = map(int, input().split())
p = set(map(int, input().split()))
l = set(range(102))
l = l - p
a = list(l)
a = sorted(a, reverse=True)
t = 101; ans=-1
for i in a:
    if(t >= abs(x-i)):
        t = abs(x-i)
        ans = i
print(ans)

Measured memory_bytes: 61844
#!/usr/bin/env python3
#ABC68 B

n = int(input())
def count(n):
    c = 0
    while 1:
        if n % 2 == 0:
            n /= 2
            c += 1
        else:
            break
    return c

ma = 0
for i in range(1,n+1):
    if ma < count(i):
        ans = i
        ma = count(i)
if ma == 0:
    ans = 1
print(ans)


Measured memory_bytes: 38640
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
const ll mod=1e9+7; 
double a[105];
int n,m;
void solve(){
	sc(n);sc(m);
	double count=0;
	rep(i,1,n){
		scanf("%lf",&a[i]);count+=a[i];
	}count/=(1.0*4*m);
	sort(a+1,a+n+1);
	if(a[n-m+1]<count)pf("No\n");
	else pf("Yes\n");
}
int main(){
  	solve();
}

Measured memory_bytes: 256
#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        N: usize,
        a: [i64; N],
    }
    use std::cmp::min;
    let mut ans = 1 << 60;
    for x in -100..101 {
        let s = a.iter().map(|&y| (x - y) * (x - y)).sum::<i64>();
        ans = min(ans, s);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;



int main(){
    int T, A, N;
    int H[1000] = {0};
    double mini = 1 << 30;
    int log = 0;
    cin >> N;
    cin >> T >> A;
    for(int i=0;i<N;i++){
        cin >> H[i];
    }
    for(int i=0;i<N;i++){
        if(mini > abs(A - (T - 0.006*H[i]))){
            mini = abs(A - (T - 0.006*H[i]));
            log = i+1;
        }
    }
    cout << log << endl;
}


Measured memory_bytes: 256
import math

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

dis = []
for i in range(n-1):
    for j in range(i+1, n):
        dis.append(((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**(1/2))
print(2*math.factorial(n-1)*sum(dis)/(math.factorial(n)))

Measured memory_bytes: 9392
#include <stdio.h>
#include <vector>
#include <list>
#include <map>
#include <array>
#include <memory>
#include <string>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <stdexcept>


using std::string;
using std::vector;


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// util
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

std::vector<std::string> split(const std::string& input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// user func
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void printList(const vector<int>& list) {
    // print
    for(int i = 0; i < list.size(); i++){
        printf("%d", list[i]);
        if ( i + 1 != list.size() ) {
            printf(" ");
        }
    }
    printf("\n");
}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// logic
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



void solve() {
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        int value;
        scanf("%d", &value);
        int k;
        scanf("%d", &k);
        vector<int> row(n, 0);
        for(int j = 0; j < k; j++){
            int link;
            scanf("%d", &link);
            row[link -1] = 1;
        }
        printList(row);
    }
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// main
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 3228
from collections import deque

N, Q = map(int, input().split())
AB = {i: set() for i in range(1, N+1)}
for i in range(N - 1):
    tmpA, tmpB = map(int, input().split())
    AB[tmpA].add(tmpB)
    AB[tmpB].add(tmpA)
P = [0] * Q
X = [0] * Q
V = [0] * (N + 1)
for i in range(Q):
    P, X = map(int, input().split())
    V[P] += X

check = [0]*(N + 1)
q = deque()
q.append(1)
check[1] = 1
while q != deque():
    node = q.pop()
    for i in AB[node]:
        if check[i] == 1:
            continue
        V[i] += V[node]
        check[i] = 1
        q.appendleft(i)
print(*V[1:])

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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, K; cin >> N >> K;
  if (K > (N-1) * (N-2) / 2) {
    cout << "-1\n";
    return 0;
  }
  stringstream ss;
  ll m = 0;
  for (ll i = 2; i <= N; i++) {
    ss << "1 " << i << "\n";
    m++;
  }
  ll cnt = (N - 1) * (N - 2) / 2;
  for (ll i = 2; i <= N; i++) {
    for (ll j = i + 1; j <= N; j++) {
      if (cnt == K) break;
      ss << i << " " << j << "\n";
      m++;
      cnt--;
    }
  }
  cout << m << endl;
  cout << ss.str();

  return 0;
}



Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((a+b+c)>21){
    cout << "bust" << endl;
  }
  else{
    cout << "win" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
a,b,c=map(int,input().split())
ans=0
if a%2==0 or b%2==0 or c%2==0:
    print(0)
else:
    ans=a*b*c-2*max(a*b*(c//2),c*b*(a//2),a*c*(b//2))
    print(ans)

Measured memory_bytes: 3060