akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        string[] input1 = Console.ReadLine().Split(' ');
        string[] input2 = Console.ReadLine().Split(' ');
        int n = int.Parse(input1[0]);
        int m = int.Parse(input1[1]);
        int[] a = Array.ConvertAll(input2, int.Parse);
        int ans = 0, sum = a.Sum();
        for (int i = 0; i < n; i++)
        {
            if (a[i] >= sum / (4.0 * m))
            {
                ans++;
            }
        }
        if (ans >= m)
        {
            Console.WriteLine("Yes");
        } else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13268
import java.util.*;
import java.math.*;
public class Main {
	
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int cnt = 0;
		
		while(N !=1){
		N = N >> 1;
		cnt++;
		}
		
		System.out.println(N << cnt);
	}
}

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

using namespace std;
typedef long long LL;
LL a[100005];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    LL ans=0;
    if(n%2==1)
    {
        int num=(n-1)/2;
        for(int i=n;i>=n-(n-1)/2+1;i--)
        {
            ans+=a[i]*2;
        }
        for(int i=1;i<=(n-1)/2-1;i++)
        {
            ans-=a[i]*2;
        }
        for(int i=(n-1)/2;i<=n-(n-1)/2;i++)
        {
            ans-=a[i];
        }
        LL sum=0;
        for(int i=1;i<=n/2;i++)
        {
            sum-=a[i]*2;
        }
        sum+=a[n/2+1]+a[n/2+2];
        for(int i=n/2+3;i<=n;i++)
        {
            sum+=a[i]*2;
        }
        if(sum>ans)
        {
            ans=sum;
        }
    }
    else
    {     
         for(int i=n;i>=n-(n-2)/2+1;i--)
         {
             ans+=a[i]*2;
         }
         ans+=a[n-(n-2)/2];
         ans-=a[n-(n-2)/2-1];
         for(int i=1;i<=(n-2)/2;i++)
         {
             ans-=a[i]*2;
         }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>  
using namespace std;  
#define create clear

typedef pair< int , int > Pi;

int w, h, n, sx, sy;
char mas[20][20];
struct sell{
  int d, s, e; //終了時刻  
};
sell shop[10];
int dp[2][1 << 8][20][20];
const int dy[] = { 0, 1, 0, -1}, dx[] = { 1, 0, -1, 0};

int main(){

  while(cin >> w >> h, w){

    memset( dp, -1, sizeof(dp));

    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        cin >> mas[i][j];
        if(mas[i][j] == 'P'){
          mas[i][j] = '.';
          sx = j, sy = i;
        }
      }
    }


    cin >> n;
    int change[10];
    fill_n( change, 10, -1);
    for(int i = 0; i < n; i++){
      int a, b, c, d;
      cin >> a >> b >> c >> d;
      shop[i] = (sell){ b, c, d};
      change[a] = i;
    }

    int cur = 0, next = 1;
    int ans = 0;
    dp[cur][0][sy][sx] = 0;
    for(int time = 0; time < 100; time++){
      memset(dp[next], -1, sizeof(dp[next]));
      for(int y = 0; y < h; y++){
        for(int x = 0; x < w; x++){
          for(int i = 0; i < (1 << 8); i++){
            if(dp[cur][i][y][x] == -1) continue;
            vector< int > item;
#define rep(i,n) for(int i  =0; i < n; i++)
            // item.clear();
            int ret = -1;
            for(int j = 0; j < 4; j++){
              int ny = y + dy[j], nx = x + dx[j];
              if(ny < 0 || ny >= h || nx < 0 || nx >= w || mas[ny][nx] == '.') continue;
              int pos = change[mas[ny][nx] - '0'];
              if(change[pos] == -1) continue;
              if(shop[pos].s <= time && time < shop[pos].e) item.push_back(pos);
            }

            for(int k = 0; k < (1 << item.size()); k++){
              int bit = i, next_cost = dp[cur][i][y][x];
              bool flag = false;
              for(int l = 0; l < item.size(); l++){
                if((k >> l) & 1){
                  if((bit >> item[l]) & 1){
                    flag = true;
                    break;
                  }
                  next_cost += shop[item[l]].d;
                  bit |= 1 << item[l];
                }
              }
              if(~flag)
                for(int l = 0; l < 4; l++){
                  int ny = y + dy[l], nx = x + dx[l];
                  if(ny < 0 || ny >= h || nx < 0 || nx >= w || isdigit(mas[ny][nx])) continue;
                  if(dp[next][bit][ny][nx] == -1 || dp[next][bit][ny][nx] > next_cost){
                    dp[next][bit][ny][nx] = next_cost;
                    ans = max( ans, next_cost);
                  }
                }
            }
          }
        }
      }
      swap( next, cur);
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 2020
#include<stdio.h>
#define ll long long
int main(){
    int n , k;
    scanf("%d%d",&n,&k);
    int d[k];
    int a[k][n];
    for(int i = 0; i < k; i++){
        scanf("%d",&d[i]);
        for(int j = 0; j < d[i]; j++)
            scanf("%d",&a[i][j]);
    }
    int b[n + 1];
    for(int i = 0; i <= n; i++)
        b[i] = 0;
    for(int i = 0; i < k; i++){
        for(int j = 0; j < d[i]; j++)
            b[a[i][j]] ++;
    }
    int ans = 0;
    for(int i = 0; i <= n; i++)
        if(b[i] == 0)
            ans ++;
    printf("%d\n",ans - 1);
    return 0;
}

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

int a[30];

int main()
{
    for (int i = 0; i < 28; i++)
    {
        int p;
        cin >> p;
        p--;
        a[p]++;
    }

    for (int i = 0; i < 30; i++)
    {
        if (a[i] == 0)
        {
            cout << i + 1 << endl;
        }
    }
}


Measured memory_bytes: 3100
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int k = scanner.nextInt();
                int kk = k/2;
		if(k%2==0){
			System.out.print(kk * kk);
			System.exit(0);
		}
		System.out.print(kk + kk * kk);
	}
}

Measured memory_bytes: 22996
import sys

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


def main():
    N, *L = map(int, read().split())

    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                if (
                    L[i] + L[j] > L[k]
                    and L[i] + L[k] > L[j]
                    and L[j] + L[k] > L[i]
                    and L[i] != L[j]
                    and L[j] != L[k]
                    and L[k] != L[i]
                ):
                    ans += 1

    print(ans)
    return


if __name__ == '__main__':
    main()


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

int main(){
	int A, K, B, C=0;
	scanf("%d", &K);
	scanf("%d %d", &A, &B);
	for(int i=A; i<=B; i++){
		if(i % K == 0){
			C++;
		}
	}
	if(C>0){
		printf("OK\n");
	}else{
		printf("NG\n");
	}
	return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <set>
#include <list>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>

using namespace std; 

bool
is_good_distance(int64_t l, vector<int64_t> & a, vector<int64_t> & b)
{
    int64_t sum = 0;
    for (int64_t i = 0; i < l; ++i) {
	// cerr << "a[" << i<< "] is " << a[i] << ", b[" << i<< "] is " << b[i] << endl;
	sum = sum + (a[i] - b[i]) * (a[i] - b[i]);
    }
    double d = sqrt((double)sum);
    // cerr << "sum is " << sum << ", d is " << d << endl;
    if (((int64_t) d) * ((int64_t) d) == sum) {
	return true;
    }
    return false;
}


int
main(int argc, char const *argv[])
{
    int64_t n, d;
    cin >> n >> d;
    vector<vector<int64_t>> v(n);

    for (int64_t i = 0; i < n; ++i) {
	vector<int64_t> s(d);
	for (int64_t j = 0; j < d; ++j) {
	    cin >> s[j];
	}
	v[i] = s;
    }

    int64_t ans = 0;
    for (int64_t i = 0; i < n; ++i) {
	for (int64_t j = i+1; j < n; ++j) {
	    if (is_good_distance(d, v[i], v[j])) {
		++ans;
	    }
	}
    }
    
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main() {
    string s; cin >> s; int ans = 0;
    for (int i = 0; i < s.length() / 2; i++) {
        if (s[i] != s[s.length() - 1 - i]) {
            ans++;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3600
N, M = map(int, input().split())
A = [input() for a in range(N)]
B = [input() for b in range(M)]
ans = False
for h in range(N - M + 1):
    for w in range(N - M + 1):
        if ans == True:
            break
        for m in range(M):
            if A[h + m][w:w + M] == B[m]:
                pass
            else:
                ans = False
                break
            ans = True
if ans == True:
    print('Yes')
else:
    print('No')

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

using namespace std;
typedef long long ll;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)

const ll N = 123456;
const ll mod = 1e9 + 7;

ll power(ll a , ll b) {
    if(b == 0) return 1LL;
    ll d = power(a , b / 2);
    d *= d;
    d %= mod;

    if(b % 2 != 0) d *= a;

    d %= mod;

    return d;
}

ll inverse_mod(ll a) {
    return power(a , mod - 2);
}

ll f[N];

ll ncr(ll no , ll r) {
    if(r == 0) return 1LL;
    if(r > no) return 0LL;
    if(r == no) return 1LL;
    ll ans = f[no];
    ans *= inverse_mod(f[r]);
    ans %= mod;
    ans *= inverse_mod(f[no - r]);
    ans %= mod;
    return ans;
}

double a[N];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cout.precision(10);

    int n; cin >> n;

    rep(i , 1 , n) cin >> a[i];

    sort(a + 1 , a + n + 1);

    double sum = 0;

    sum = a[1] + a[2];

    sum /= 2;

    rep(i , 3 , n) {
        sum = (sum + a[i]) / 2;
    }

    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
K,N=map(int,input().split())
#print(n)
A=list(map(int,input().split()))
B=[]
for i in range(len(A)):
    if i==0:
        Z=A[N-1]-A[0]
        B.append(Z)
    else:
        Z=K+A[i-1]-A[i]
        B.append(Z)
        
print(min(B))

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

int main() {
  int a,b;
  cin >> a >> b;
  if (a>12) {
    cout << b << endl;
  }
  else if (a>5) {
    cout << b/2 << endl;
  }
  else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 3540
def main():
    n = int(input())
    s = [int(input()) for _ in range(n)]
    s_sum = sum(s)
    s = [i for i in s if i % 10 != 0]
    s.sort()
    if s_sum % 10 != 0:
        print(s_sum)
        exit()
    for es in s:
        if (s_sum - es) % 10 != 0:
            print(s_sum - es)
            exit()
    else:
        print(0)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(ll i=(begin);i<=(end);i++)
// #define REP(i, n) FOR(i,0,n)
// #define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
// #define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
using namespace std;
#define ll long long

bool is_prime(int k)
{
	for(int j=2;j*j<=k;j++){
		if(k%j==0) {
			return false;
		}
	}
    return true;
}

ll S(ll N)
{
    ll S=0;
    while(N>0){
        S+=N%10;
        N=N-N%10;
        N=N/10;
    }
    return S;
}

int main()
{
    stringstream ss;
    // 入力
    ll K;
    cin>>K;
    ll digit=1;
    ll base=0;
    ll top=1;
    ll N=0;
    ll M=0;
    while(K>0) {
    	N=top*digit+base;
    	M=(top+1)*digit + base;
    	if ((double)N/S(N)<=(double)M/S(M)) {
    		cout<<N<<endl;
    		// cout<<N<<","<<(double)N/S(N)<<endl;
    		K--;
    		top++;
    	} else {
    		top=top/10;
    		base=base*10+9;
    		digit*=10;
    	}
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class CFlipFlipandFlip {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            long res = 0;
            if (a == 1 && b == 1) {
                res = 1;
            } else if (a == 1) {
                res = b - 2;
            } else if (b == 1) {
                res = a - 2;
            } else {
                res = (long) (a - 2) * (b - 2);
            }
            out.println(res);
        }

    }
}



Measured memory_bytes: 21972
import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		int v = Integer.parseInt(line);

		for (int i = 1; i <= v; i++) {
			if (i % 3 == 0) {
				System.out.print(" " + i);
			}
			else if (String.valueOf(i).contains("3")) {
				System.out.print(" " + i);
			}
		}
		System.out.println("");
	}
}

Measured memory_bytes: 28772
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
typedef struct _data
{
    int node;
    int weight;
}Data;
vector<Data> vec[100005];
int N, M, chk[100005], dist[100005], result;

void BFS()
{
    queue<Data> q;
    for(int j = 1; j <= N; j++)
    {
        if(chk[j] == 0)
        {
            chk[j] = 1;
            q.push({j, 0});
        }
        while(!q.empty())
        {
            Data temp;
            temp = q.front();
            q.pop();
            for(int i = 0; i < vec[temp.node].size(); i++)
            {
                Data next;
                next.node = vec[temp.node][i].node;
                next.weight = temp.weight + vec[temp.node][i].weight;
                if(chk[next.node] == 0)
                {
                    chk[next.node] = 1;
                    dist[next.node] = next.weight;
                    q.push(next);
                }
                else
                {
                    if(dist[next.node] != next.weight)
                    {
                        result = 1;
                        return;
                    }
                }
            }
        }
    }
}

int main()
{
    scanf("%d %d", &N, &M);
    for(int i = 0; i < M; i++)
    {
        int l, r, d;
        scanf("%d %d %d", &l, &r, &d);
        vec[l].push_back({r, d});
        vec[r].push_back({l, -d});
    }
    BFS();
    result == 0 ? printf("Yes") : printf("No");
}

Measured memory_bytes: 9984
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    int k, t = 0;
    cin >> k;
    rep(i, k) {
        int b;
        cin >> b;
        t |= 1 << b;
    }
    rep(bit, 1 << n) {
        if ((bit & t) != t) continue;
        cout << bit << ":";
        rep(i, n) if (bit >> i & 1) cout << " " << i;
        cout << endl;
    }
}



Measured memory_bytes: 3216
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n-1;i>s;i--)
#define rep_re(i,s,n)for(ll i = n-1;i>=s;i--)
ll MOD = 1e9 + 7;

int main() {
	ll a, b; cin >> a >> b;
	//repe(i, 1, 1000) {
		repe(j, 1, 1250) {
	/*		if (j == 25) {
				cout << endl;
			}*/
			if (a == (ll)(j * 0.08) && b == (ll)(j * 0.10)) {
				cout << j << endl;
				return 0;
			}
		}
	//}
	cout << -1 << endl;
	return 0;
	//double a, b; cin >> a >> b;

	//double c = (double)(a / 0.08);
	//double d = (double)(b / 0.10);

	//if (c > d)swap(c, d);

	////cout << c << " " << d << endl;
	//ll ans = (ll)d;
	//repe(i, ans, 1250) {
	//	if ((ll)(d * 0.08) == a && (ll)(d * 0.1) == b) {
	//		cout << ans << endl;
	//		return 0;
	//	}
	//}
	//cout << -1 << endl;




	return 0;
}


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

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;

    int liked[M] = { 0 };
    int number_liked, food_liked;
    for (int i = 0; i < N; i++)
    {
        cin >> number_liked;
        for(int j = 0; j < number_liked; j++)
        {
            cin >> food_liked;
            liked[food_liked - 1]++;
        }
    }
    
    number_liked = 0;
    for (int i = 0; i < M; i++)
    {
        if (liked[i] == N)
        {
            number_liked++;
        }
    }

    cout << number_liked;
}


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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var dict = new Dictionary<string, int>();

            for (int i = 0; i < N; i++)
            {
                var s = Console.ReadLine();
                if (dict.ContainsKey(s)) dict[s]++;
                else dict.Add(s, 1);
            }

            var max = dict.Values.Max();
            var keys = dict.Where(kv => kv.Value == max).Select(kv => kv.Key).ToList();
            keys.Sort(StringComparer.OrdinalIgnoreCase);

            keys.ForEach(s => Console.WriteLine(s));
        }
    }
}

Measured memory_bytes: 41436
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

bool isPrime(int x)
{
  for (int i = 2; i*i <= x; ++i)
  {
    if(x%i==0) return false;
  }
  return true;
}

int main()
{
  int x;
  cin>>x;
  while(!isPrime(x))
  {
    x++;
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
n = int(input())
global S, Q, l
S = [0]
Q = [0]
l = [1000000 for _ in range(n)]
l[0] = 0
graph = [[-1 for _ in range(n)] for _ in range(n)]
def input_graph(n):
  for _ in range(n):
    node_id, k, *v_list = list(map(int, input().split()))
    for j in range(k):
      ad_node, w = v_list[2*j], v_list[2*j+1]
      graph[node_id][ad_node] = w 


def dijkstra():
  while Q:
    u = float('inf') #10000000
    u_c = float('inf') #10000000
    for i in range(n):
      if i in Q and u_c > l[i]:
        u = i
        u_c = l[i]
    #print(l, u, S, Q)
    for i in range(n):
      v = i 
      if v not in S and graph[u][v] != -1:
        S.append(v)
        Q.append(v)
        l[v] = l[u] + graph[u][v]
      if (v in Q) and (l[v] > l[u] + graph[u][v]) and graph[u][v] != -1:
        l[v] = l[u] + graph[u][v]
    Q.remove(u)


if __name__ == "__main__":
  input_graph(n)
  dijkstra()
  for i, c in enumerate(l):
    print(i, c)


Measured memory_bytes: 5772
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i,m,n) for(int i = m - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
#define println(x) cout << x << endl
#define print(x) cout << x << " "
template<typename T, typename U>
inline bool CMAX(T &m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool CMIN(T &m, U x) { if (m > x) { m = x; return true; } return false; }

typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
const int MOD = 1e9+7;
int main(){
    int x;
    cin >> x;
    if(x >= 30)
        Yes();
    else No();
    return 0;
}

Measured memory_bytes: 3632
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n,k=MI()
    pp=LI()
    ev=[]
    for p in pp:
        ev.append((p+1)/2)
    mx=0
    cur=0
    for i in range(n):
        cur+=ev[i]
        if i-k>=0:cur-=ev[i-k]
        if cur>mx:mx=cur
    print(mx)

main()

Measured memory_bytes: 25628
class UnionFind():
    def __init__(self, n):
        self._n = n
        self._table = [-1]*n
        self._rank = [0]*n

    def _root(self, x):
        stack = []
        while self._table[x] >= 0:
            stack.append(x)
            x = self._table[x]
        for y in stack:
            self._table[y] = x
        return x
    
    def unite(self, x, y):
        x, y = self._root(x), self._root(y)
        if x == y:
            return
        elif self._rank[x] > self._rank[y]:
            self._table[x] += self._table[y]
            self._table[y] = x
        else:
            self._table[y] += self._table[x]
            self._table[x] = y
            if self._rank[x] == self._rank[y]:
                self._rank[y] += 1
    
    def find(self, x, y):
        return self._root(x) == self._root(y)

    def count(self, x):
        return -self._table[self._root(x)]
    
    def __str__(self):
        return str(list(self))
    def __repr__(self):           
        return repr(list(self))
    def __iter__(self):
        return (self._root(i) for i in range(n))
    def __list__(self):
        return list(iter(self))

from collections import defaultdict
n, m, *X = map(int, open(0).read().split())
P, XY = X[:n], X[n:]

uf = UnionFind(n)
for x, y in zip(XY[::2], XY[1::2]):
    uf.unite(x-1, y-1)
group = list(uf)

d1 = defaultdict(set)
d2 = defaultdict(set)
for i, n in enumerate(group, 1):
    d1[n].add(i)
    d2[n].add(P[i-1])

ans = 0
for i in set(group):
    ans += len(d1[i] & d2[i])
print(ans)

Measured memory_bytes: 91032
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, k, q, a;
    int A[100005] = {};
    
    cin >> n >> k >> q;
    for(int i=0;i<q;i++){
        cin >> a;
        A[a-1]++;
    }
    for(int i=0;i<n;i++){
        if(k-q+A[i]>0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

char D[4] = {'N', 'S', 'E', 'W'};
bool x[4];

int main() {
    string s;
    cin >> s;
    for(auto n : s) {
        for(int d = 0; d < 4; d++) {
            if(n == D[d]) {
                x[d] = true;
            }
        }
    }
    if(x[0] == x[1] && x[2] == x[3]) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
  public static void main(String[] args){
    try {
      Scanner sc = new Scanner(System.in);
      int x, y;
      x=Integer.parseInt(sc.next());
      y=Integer.parseInt(sc.next());

      System.out.println(x+y/2);
      
      }catch (Exception e) {
      System.out.println("out");
    }
  }
}


Measured memory_bytes: 21204
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a;
	string b;
	cin>>a;
	cin>>b;
	if(a<3200){
		cout<<"red"<<endl;
	}
	if(a>=3200){
		cout<<b<<endl;
	}
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n;
ll mo=1000000007;
ll power(ll x, ll y, ll p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
int main(){

  ll n;
  cin>>n;
  ll ans=0;
  for(ll i=1;i<=n;i++)
  {  ll x;
     cin>>x;
      if(i%2!=0 && x%2!=0 )
      ans++;
  }
  cout<<ans;

    return 0;
}
    


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        string s1, s2;
        cin >> s1 >> s2;
        int n = s1.length();
        int ct = 0;
        for (int i = 0; i < n; ++i)
        {
            if (s1[i] != s2[i])
                ct++;
        }
        cout << ct << "\n";
    }
}

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

using namespace std;

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

const int N = 9;

int va[10];
int vb[10];

int main(){
	cout.setf(ios::fixed);
	cout.precision(8);
	int T;
	cin >> T;
	while(T--){
		rep(i, N) cin >> va[i];
		rep(i, N) cin >> vb[i];
		int acnt = 0;
		int bcnt = 0;
		sort(vb, vb+N);
		do{
			int a = 0, b = 0;
			rep(i, 9){
				if(va[i] > vb[i]) a += va[i] + vb[i];
				else b += va[i] + vb[i];
			}
			acnt += (a > b);
			bcnt += (b > a);
		}while(next_permutation(vb, vb+N));
		cout << acnt/362880. << ' ' << bcnt/362880. << endl;
	}

	return 0;
}

Measured memory_bytes: 1252
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const int mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;


int main()
{
    int n;
    cin >> n;
    int x[n];
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }
    int ans = INF;
    for(int i = 0; i < n; i++){
        int s = 0;
        int t = 0;
        for(int j = 0; j < i; j++){
            s += x[j];
        }
        for(int j = i; j < n; j++){
            t += x[j];
        }
        ans = min(ans,abs(s-t));
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    sort(h.begin(), h.end());
    if (n <= k)
        cout << 0 << endl;
    else
        cout << accumulate(h.begin(), h.end() - k, 0LL) << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
   int n,x;
   int i,j,k;
   int a=0;
   
   while(1){
        scanf("%d %d",&n,&x);
        if(n==0 && x==0) break;
        for(i=1;i<=n-2;i++){
            for(j=i+1;j<=n-1;j++){
                for(k=j+1;k<=n;k++){
                    if((i+j+k)==x) a++;                                     
                }
           }
       }
       printf("%d\n",a);
       a=0;
   }
   return 0;
}


Measured memory_bytes: 2104
def main():
    from operator import itemgetter
    import sys
    input = sys.stdin.readline
    N, M = map(int, input().split())

    prefectures = [[] for _ in range(N + 1)]
    for m in range(M):
        p, y = map(int, input().split())
        prefectures[p].append((y, m))

    ans = [''] * M
    for p, pref in enumerate(prefectures, start=0):
        pref.sort(key=itemgetter(0))
        for i, (_, m) in enumerate(pref, start=1):
            ans[m] = '{:06d}{:06d}'.format(p, i)

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 37580
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    map<string,int> a;
    int n;
    cin>>n;
    string s;
    rep(i,n){
        cin>>s;
        a[s] ++;
    }
    cout<<"AC x "<<a["AC"]<<endl;
    cout<<"WA x "<<a["WA"]<<endl;
    cout<<"TLE x "<<a["TLE"]<<endl;
    cout<<"RE x "<<a["RE"]<<endl;
//     AC x 3
// WA x 1
// TLE x 2
// RE x 0

}/*
./problem.exe
*/

Measured memory_bytes: 3660
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)1e5+5;
const int M = (int)3e3+5;
const int Q = 401;
const int logN = 19;

ll dp[N][2];
vector<int> v[N];
ll dfs(int i,int p,int c) {
    if(dp[i][c]!=(-1)) return dp[i][c];
    ll ret = 1;
    if(c==0) {
        //White
        for(auto it:v[i]) {
            if(it!=p) {
                ret = (ret*(dfs(it,i,0)+dfs(it,i,1)))%mod;
            }
        }
    }
    else {
        //Black
        for(auto it:v[i]) {
            if(it!=p) {
                ret = (ret*dfs(it,i,0))%mod;
            }
        }
    }
    dp[i][c] = ret;
    return ret;
}
void solve() {
    int n,x,y;
    cin>>n;
    REP(i,1,n-1) {
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    mms(dp,-1);
    cout<<(dfs(1,1,0)+dfs(1,1,1))%mod;
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 15616
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	char a,b; cin>>a>>b;
	if (a==b) cout<<"H";
	else cout<<"D"<<endl;
	return 0;
}


Measured memory_bytes: 3576
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    
    int R[200000];
    int n;
    cin>>n;
    for(int i=0;i<n;i++)cin>>R[i];
    int maxv=-1000000000;
    int minv=R[0];
    
    for(int j=1;j<n;j++){
        maxv=max(maxv,R[j]-minv);
        minv=min(minv,R[j]);
    }
   cout<<maxv<<endl;
    return 0;
}



Measured memory_bytes: 3880
import numpy as np
a = [[j for j in map(int,input().split())] for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0
a = np.array(a)
if sum(a[0,:]) == 0 or sum(a[1,:]) == 0 or sum(a[2,:]) == 0:
    print('Yes')
elif sum(a[:,0]) == 0 or sum(a[:,1]) == 0 or sum(a[:,2]) == 0:
    print('Yes')
elif (a[0][0] + a[1][1] + a[2][2]) == 0 or (a[0][2] + a[1][1] + a[2][0]) == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 12396
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using namespace std;
//LLONG_MAX = 90^18
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No"); }
void Yes() { cout << "Yes"; }
void No() { cout << "No"; }
//max_element


signed main()
{

	char s[256];
	char t[256];

	cin >> s;
	cin >> t;

	t[strlen(t) - 1] = '\0';
	YesNo(strcmp(s, t) == 0);
}




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

struct Card {char suit, value;};

void print(struct Card A[], int N){
    for (int i = 0; i < N; i++){
        if (i) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

void BubbleSort(struct Card A[], int N){
    for (int i = 0; i < N; i++){
        for (int j = N - 1; j >= i + 1; j--){
            if (A[j].value < A[j - 1].value){
                swap(A[j], A[j - 1]);
            }
        }
    }

}

void SelectionSort(struct Card A[], int N) {
    for (int i = 0; i < N; i++){
        int minj = i;
        for (int j = i; j < N; j++){
            if (A[j].value < A[minj].value) minj = j;
        }
        swap(A[i], A[minj]);
    }
}

bool isStable(struct Card A[], struct Card B[], int N){
    for (int i = 0; i < N; i++){
        if (A[i].suit != B[i].suit) return false;
    }
    return true;
}

int main(void){
    int N;
    cin >> N;
    Card C1[100], C2[100];
    for(int i = 0; i < N; i++) {
        cin >> C1[i].suit >> C1[i].value;
        C2[i] = C1[i];
    }
    
    BubbleSort(C1, N);
    SelectionSort(C2, N);
    
    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if ( isStable(C1, C2, N)) cout << "Stable";
    else cout << "Not stable";
    cout << endl;
    
    return 0;

}


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


int main() {
	int N, x;
	cin >> N >> x;

	vector<int> a(N);
	for(int i=0;i<N;i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	ll s = 0;
	for(int i=0;i<N;i++) {
		if(s + a[i] > x) {
			cout << i << endl;
			return 0;
		}
		s += a[i];
	}
	if (s == x) cout << N << endl;
	else cout << N - 1 << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1000000000000000000;
long long mod=1000000007;



int N,u,v;
vector<vector<int>>edge(100010);
int distance_u[100010];
int distance_v[100010];


void dist_u(int u){

    queue<int>q;

    q.push(u);

    bool reached[100010]={};
    
    rep(i,N)distance_u[i]=1e9;

    reached[u]=true;
    distance_u[u]=0;
    while(!q.empty()){

        int now=q.front();
        q.pop();
        
        if(now==v)continue;

        for(auto nv:edge[now]){
            if(reached[nv])continue;
            distance_u[nv]=distance_u[now]+1;
            reached[nv]=true;
            q.push(nv);
        }
    }

    return ;
}

void dist_v(int v){
    queue<int>q;

    q.push(v);

    bool reached[100010]={};

    rep(i,N)distance_v[i]=1e9;

    distance_v[v]=0;
    reached[v]=true;
    while(!q.empty()){
        int now=q.front();
        q.pop();
        
        

        for(auto nv:edge[now]){
            if(reached[nv])continue;
            distance_v[nv]=distance_v[now]+1;
            reached[nv]=true;
            q.push(nv);
        }
    }

    return;

}


int main(){


cin>>N>>u>>v;
u--;
v--;

distance_v[v]=0;



rep(i,N-1){
    int a,b;
    cin>>a>>b;
    a--,b--;
    edge[a].emplace_back(b);
    edge[b].emplace_back(a);
}

if(edge[u].size()==1 && edge[u][0]==1){
    cout<<"0"<<endl;
    return 0;
}


/*
(i)最初の行動でTがAのいる頂点にしか移動できない時=>ans=0

(ⅱ)そうでない時
TとAはすれ違えないので、ゲームが終了するのはTが行き止まりに追い詰められた時。
言い換えると、Aの初期位置を根として、Tが葉xにいてAがxの親の親である時、
それぞれ一回の移動でゲームが終了する。

Aは最短距離でTを追跡できるのでAの移動回数はTが追い詰められる葉xの位置によって決まる。

ここで葉xについて、葉xはTがAよりも早く到達できる葉の中で、
Tの初期位置からもっとも遠い葉になる。

そのような葉xをDFSまたはBFSで求める。

*/
vector<int>cand;

rep(i,N){
    if(edge[i].size()==1){
        cand.emplace_back(i);
    }
}

int ans=-1;

dist_u(u);
dist_v(v);
/*
rep(i,N)cout<<distance_u[i]<<" ";
cout<<endl;



rep(i,N)cout<<distance_v[i]<<" ";
cout<<endl;
*/


for(auto nv:cand){
    //cout<<(distance_u[nv])<<" "<<distance_v[nv]<<endl;
    if(distance_u[nv]<distance_v[nv]){
        ans=max(ans,distance_v[nv]-1);
    }
}

cout<<ans<<endl;



return 0;

}
/*
5 4 1
1 2
2 3
3 4
3 5

2

5 4 5
1 2
1 3
1 4
1 5

1

2 1 2
1 2

0

9 6 1
1 2
2 3
3 4
4 5
5 6
4 7
7 8
8 9

5
*/


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

int main() {

  while( true ) {

    long long int n;
    cin >> n;
    if ( n == 0 ) break;

    long long int f[201] = {0};
    for ( long long int i = 0; i < n; i++ ) {
      long long int in;
      cin >> in;
      f[in] = 1;
    }

    long long int cnt[2] = { n, n };

    long long int k = 1;
    long long int b = 1;
    while( true ) {
      if ( f[k] == b ) {
	f[k] = -1;
	cnt[b]--;
	if ( cnt[b] == 0 ) {
	  long long int ans[2] = {0};
	  for ( long long int i = 1; i <= 2 * n; i++ ) {
	    if ( f[i] >= 0 ) ans[1-b]++;
	  }
	  cout << ans[0] << endl << ans[1] << endl;
	  break;
	}
	b = 1 - b;
      }
      k++;
      if ( k > 2 * n ) {
	k = 1;
	b = 1 - b;
      }
    }

  }

  return 0;

}

Measured memory_bytes: 1156
import java.util.*;

class Main {

    Main(){
        Scanner SC = new Scanner(System.in);
        String S = SC.next();

        String HI = "hi";
        while(S.length() >= HI.length()){
            if(S.equals(HI)){
                System.out.println("Yes");
                return;
            }
            HI = HI + "hi";
        }

        System.out.println("No");
    }

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


Measured memory_bytes: 23380
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long H = Integer.parseInt(sc.next());
        long W = Integer.parseInt(sc.next());
        double N = (double) H * W / 2;
        long result = 0;
        PrintWriter out = new PrintWriter(System.out);

        if (H == 1 || W == 1) {
            out.println(1);
            out.flush();
            sc.close();
            return;
        }

        result = (long) Math.ceil(N);

        out.println(result);
        out.flush();
        sc.close();
    }
}

Measured memory_bytes: 35640
#include <bits/stdc++.h>
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  string s;
  cin >> s;

  cout << s.rfind('Z') - s.find('A') + 1 << endl;
  return 0;
}


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

long long oneTime;
int M;
int N;

int main()
{
    cin >> N;
    cin >> M;

    oneTime = 1900 * M + 100 * (N - M);


    long long p = pow(2,M);

    double temp = 1.0 / p;

    cout << oneTime * temp * (p - 1) * (p- 1) / (1.0 - temp) / (1.0-temp)  ;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
//import java.lang.Math;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int alf[];
        alf=new int[256];
        while(sc.hasNext()){
            String S=sc.next();
            int L=S.length();
            S=S.toLowerCase();
            char s[]=S.toCharArray();
            for(int i=0;i<L;i++){
                if(s[i]=='.') continue;
                if(s[i]-'a'>=0 && s[i]-'a'<=25) alf[s[i]-'a']++;
            }
        }
        for(int i=0;i<26;i++) System.out.printf("%c : %d\n",'a'+i,alf[i]);
    }
}


Measured memory_bytes: 26408
import java.util.Scanner;

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

        int count = 0;

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        for (int i = a; i<=b; i++) {
            if (c%i == 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 26296
fun main(args: Array<String>) {
    val (N, K) = listOfInt()
    val H = listOfLong().sorted()
    var ans = if (N > K) H.dropLast(K).sum() else 0L
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)


Measured memory_bytes: 85620
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
#print(a)
h=a[0]/2
dif=10**18
tmp=None
for i in range(1,n):
    if dif>abs(a[i]-h):
        dif=abs(a[i]-h)
        tmp=a[i]
print(a[0],tmp)

Measured memory_bytes: 20016
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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,
       m: usize
    }
    println!("{}", if n == m { "Yes" } else { "No" })
}


Measured memory_bytes: 4352
/****************************
*  Developer : joshi08
*  Date  :  22-06-2020
*  Year  :  2020
****************************/

#include <bits/stdc++.h>

#define lli long long int
#define mod 1000000007
#define fi first
#define se second
#define ii pair<lli, lli>
#define mp make_pair
#define endl '\n'
const double PI = 3.141592653589793238460;
lli gcd(lli a, lli b) { if (a == 0) return b; return gcd(b % a, a);}
lli max(lli a, lli b) {if (a > b) return a; else return b;}
lli min(lli a, lli b) {if (a < b) return a; else return b;}
lli power(lli a,lli b) {lli i,p=1; for(i=0;i<b;i++){p*=a;} return p;}

using namespace std;

int main()
{
    ios::sync_with_stdio(false);

	lli a,b,n,i,j,k,ans=0;
	
	cin>>n>>a>>b;
	
	k = n/(a+b);
	
	ans = k*a;
	ans += (min(a,n-(k*(a+b))));
	
	cout<<ans;

    return 0;
}



Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
bool check(int n)
{
	int a,b,c;
	c=n%10; n/=10;
	b=n%10; n/=10;
	a=n%10;
	if (a==b && b==c) return true;
	return false;
}
int main()
{
	int n;
	cin>>n;
	for (int i=n;i<=999;i++)
	{
		if (check(i))
		{
			cout<<i;
			return 0;
		}
	}
    return 0;
}

Measured memory_bytes: 256