akhauriyash/Code-Regression huggingface dataset:
// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;

int main()
{
  ll a, b;

  cin >> a >> b;
  ll c = (a + b) / 2;

  if ((a + b) % 2 == 0)
  {
    cout << c << endl;
  }
  else
  {
    cout << c + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

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

int main() {
	int n, a, b, c, x;
	while(cin >> n >> a >> b >> c >> x, n||a||b||c||x) {
		int y[n];
		rep(i, n) cin >> y[i];
		int res = 0, p=0;
		while(p<n) {
			if(x == y[p]) {
				p++;
				if(p==n) break;
			}
			res++;
			if( res > 10000 ) {
				res = -1;
				break;
			}
			x = (a * x + b) % c;
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>

typedef long long ll;

int main(){
  int N;
  std::cin >> N;
  ll a[N];
  for(ll i; i < N; ++i){
    std::cin >> a[i];
    if(a[i] == 0){
      std::cout << 0 << std::endl;
      return 0;
    }
  }
  
  ll max = 1e18;
  ll multi = 1;
  
  for(ll e : a){
    if(multi > max / e){
      std::cout << -1 << std::endl;
      return 0;
    };
    multi *= e;
  }
  if(multi <= max){std::cout << multi << std::endl;}
  return 0;
}


Measured memory_bytes: 4380
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int F(long a, long b)
{
  string sa = to_string(a);
  string sb = to_string(b);
  return max(sa.size(), sb.size());
}

int main()
{
  long n; cin >> n;
  int minlen = 11;
  for (long i = 1; i < (long)sqrt(n) + 1; i++)
  {
    if (n % i == 0)
    {
      int len = F(i, n / i);
      minlen = min(len, minlen);
    }
  }
  cout << minlen << endl;
}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt(); //鉄道料金を標準入力から受け取る.
        //入力を受け取る方法は言語ごとに異なるので各自確認してください.
        int Y = sc.nextInt(); //バス料金を受け取る.
        int ans = X + Y / 2;  //合計料金は X + Y / 2 と計算できる.
        System.out.println(ans); //料金を標準出力に流す.
        //出力方法も頑張って調べてください.
    }
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int n, m;
  fscanf(stdin, "%d %d", &n, &m);
  vector<vector<ll> > a(n, vector<ll>(m));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      fscanf(stdin, "%lld", &a[i][j]);
    }
  }
  vector<ll> b(m);
  for (int i = 0; i < m; ++i) {
    fscanf(stdin, "%lld", &b[i]);
  }
  vector<ll> c(n, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      c[i] += a[i][j] * b[j];
    }
  }

  for (int i = 0; i < n; ++i) {
    fprintf(stdout, "%lld\n", c[i]);
  }
  return 0;
}

Measured memory_bytes: 1292
from math import ceil #切り上げ
import numpy as np
 
def inp(): return int(input()) #一個だけ読み取り
def inpm(): return map(int,input().split()) #mapオブジェクトで呼び出し
def inpl(): return list(map(int, input().split())) #数字リストをintで
def inpls(): return list(input().split()) #リストをstrで

N,M = inpl()
H = inpl()

all_list = []
for h in H:
  all_list.append([h])

for i in range(M):
  A, B = inpl()
  all_list[A-1].append(all_list[B-1][0])
  all_list[B-1].append(all_list[A-1][0])
  
count = 0

for ss in all_list:
  tmp = 0
  for i in range(1,len(ss)):
    if ss[i] >= ss[0]:
      tmp = 1
      break
    else:
      pass
  if tmp == 0:
    count = count+1
    

print(count)



Measured memory_bytes: 44464
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let mut abc: [usize; 3] = [0; 3];
    for i in 0..3 { abc[i] = read(); }
    println!("{}", if abc[0] * abc[2] <= abc[1] { abc[2] } else { abc[1] / abc[0] });
}


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

#define rp(i, k, n) for (ll i = k; i < n; i++)
#define ll  long long

ll mod = 1e9 + 7;

int main() {
    int n, t;
    cin >> n >> t;
    int ans = 1e9;
    int c, nowt;
    bool flag = false;
    rp(i,0,n) {
    cin >> c >> nowt;
        if(c < ans && nowt <= t) {
            ans = c;
            flag = true;
        }
    }
    if (flag) {
        printf("%d", ans);
        return 0;
    } else {
        printf("TLE");
        return 0;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)


{
	int a, b;
	scanf("%d %d", &a,&b);
	if(a<b)
	{
		printf("a < b\n");
	}
	if (a > b)
	{
		printf("a > b\n");
	}
	if (a == b)
	{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
//abc154_d
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int N,K;
double p[200010];
double E[200010],S[200010];

int main(void){
    scanf("%d %d",&N,&K);
    int i,j;
    for(i=0;i<N;i++){
        scanf("%lf",&p[i]);
        E[i]=(double)(1+p[i])/2;
    }

    double sum[N+1];
    sum[0]=0;

    for(int i=0;i<K;i++){
        sum[1]+=E[i];
    }

    int n;
    double ans=sum[1];
    for(int i=0;i<N-K+2;i++){
        if(i+K>N-1)break;
        sum[i+2]=sum[i+1]-E[i]+E[i+K];
        if(ans<sum[i+2]){
            ans=sum[i+2];
        }
    }

    printf("%lf",ans);
    return 0;
}

Measured memory_bytes: 6404
import java.util.Scanner;

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

		n = sc.nextInt();
		long ans = 0;
        for (int i = 0; i < n+1; i++) {
            if(!(i % 3 == 0 || i % 5 == 0)){
            	ans += i;
            }
        }



			System.out.println(ans);

	}
}

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

using namespace std;

const long long MOD = 1000000007;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    /*
     * REMOVE ME PLS
     */

    //freopen("input.txt", "r", stdin);

    long long length, target, best = 1;
    cin >> length >> target;

    for(long long i = 1; i * i <= target; ++i){
        if(target % i != 0) continue;
        if(i * length <= target)
            best = max(best, i);
        if((target / i) * length <= target)
            best = max(best, target / i);
    }

    cout << best;

    return 0;
}


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

const ll INF = 1ll << 60;
ll MOD = 998244353;

int main()
{

    int n;
    string s;
    cin >> n;
    cin >> s;

    string searchstr = "ABC";
    string::size_type pos = s.find(searchstr);
    int ans = 0;
    while (pos != string::npos)
    {
        ans++;
        pos = s.find(searchstr, pos + searchstr.length());
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
/* Simplicity and Goodness */
 
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;


void solve()
{   
    int n;
    scn(n);

    int a[n]; ll total = 0;

    for(auto& i : a)
        scn(i), total += i;

    ll rest = 0;

    for(int i=1; i<n; i+=2)
        rest += a[i];

    ll x[n];

    x[0] = total - 2 * rest;

    // 2 * a[i] = x_i + x_(i+1)

    for(int i=1; i<n; i++) 
        x[i] = 2LL * a[i-1] - x[i-1];
    
    for(int i=0; i<n; i++)
        lpri(x[i]);
}

int main()
{
    int t = 1;
    // scn(t);

    while(t --) {
        solve();
    }
    return 0;
}

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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int r, g, b; cin >> r >> g >> b;
    if((g*10+b) % 4 == 0) YES;
    else NO;
}

Measured memory_bytes: 3568
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  	string S;
  	cin >> S;
  	for(int i=0;i<3;i++){
  		if(S[i]==S[i+1]){
  			cout << "Bad" << endl;
  			return 0;
  		}
  	}
  	cout << "Good" <<endl;

  	return 0;
}



Measured memory_bytes: 764
class Union_Find():
    def __init__(self, N):
        self.N = N
        self.par = [n for n in range(N)]
        self.rank = [0] * N
        
    def root(self, x):
        if self.par[x] == x:
            return x
        else:
            return self.root(self.par[x])
    
    def same(self, x, y):
        if self.root(x) == self.root(y):
            return True
        else:
            return False
    
    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if (x==y): return
        if (self.rank[x] < self.rank[y]):
            self.par[x] = y
            self.rank[y] += self.rank[x] + 1
        else:
            self.par[y] = x
            self.rank[x] += self.rank[y] + 1

N, M = map(int, input().split())
UF = Union_Find(N)
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    UF.unite(a, b)
ans = -1
for n in range(N):
        ans = max(ans, UF.rank[n])
print(ans+1)

Measured memory_bytes: 18516
import copy
n = int(input())
a = list(map(int, input().split()))
a_avg = round(sum(a)/len(a))
b = copy.copy(a)
while(len(set(b)) > 1):
    for i in range(len(a)):
        if b[i] > a_avg:
            b[i] -= 1
        if b[i] < a_avg:
            b[i] += 1
s = 0
for i in range(len(a)):
    s += (a[i]-b[i])**2
print(s)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

ll dp[110][110][2];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string n;
    int k;
    cin >> n >> k;
    dp[0][0][0] = 1;
    int m = n.size();
    for(int i = 0; i < m; i++) {
        for(int j = 0; j <= m; j++) {
            int lim = n[i] - '0';
            // flg == 1
            for(int k = 0; k < 10; k++) {
                if(k == 0) {
                    dp[i + 1][j][1] += dp[i][j][1];
                } else {
                    dp[i + 1][j + 1][1] += dp[i][j][1];
                }
            }
            // flg == 0
            for(int k = 0; k <= lim; k++) {
                if(k == lim) {
                    if(k == 0) {
                        dp[i + 1][j][0] += dp[i][j][0];
                    } else {
                        dp[i + 1][j + 1][0] += dp[i][j][0];
                    }
                } else {
                    if(k == 0) {
                        dp[i + 1][j][1] += dp[i][j][0];
                    } else {
                        dp[i + 1][j + 1][1] += dp[i][j][0];
                    }
                }
            }
        }
    }
    cout << dp[m][k][0] + dp[m][k][1] << endl;
}

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

int main(){
    int a, b, c;
    long long x, y;
    long long ans = 0;
    cin >> a >> b >> c >> x >> y;
    if(a+b > 2*c){
        while(x*y != 0){
            ans += 2*c;
            x--;
            y--;
        }
    }
    if(a > 2*c){
        ans += x*c*2;
        x = 0;
    }
    if(b > 2*c){
        ans += y*c*2;
        y = 0;
    }
    ans += a*x + b*y;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define endl  "\n"
#define ll long long
#define int long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cin.exceptions(cin.failbit);cout.tie(NULL);
using namespace std;
bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i += 6)
    {
        if ((n % i == 0) || (n % (i + 2) == 0))
            return false;
    }
    return true;
}

int32_t main()
{
	int n,m;
	cin >> n >> m;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	int r=1e9,l=1;
	int ans=INT_MAX;
	while(l<r)
	{
		int mid=(l+r)/2;
		
		int cnt=0;
		for(int i=0;i<n;i++)
		{
			cnt+=(a[i]-1)/mid;
		}
		
		if(cnt<=m)
		{
			r=mid;
		}
		else
		{
			l=mid+1;
		}
	}
	cout << l; 
}




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

int main()
{
    int x;
    cin >> x;
    if (x == 7 || x == 5 || x == 3)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

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

double dp[3010][3010];

int main(void){
    int n;
    cin >> n;
    dp[0][0] = 1.0;
    rep(i,n){
        double p;
        cin >> p;
        rep(j,i+1){
            dp[j+1][i-j] += dp[j][i-j]*p;
            dp[j][i-j+1] += dp[j][i-j]*(1.0-p);
        }
    }
    double res = 0;
    rep(i,n+1){
        if(i >= n-i){
            res += dp[i][n-i];
        }
    }
    printf("%.20f\n", res);
    return 0;
}


Measured memory_bytes: 70016
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

int main(void) {
    cout << std::fixed << std::setprecision(10);
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int five = 0, seven = 0;
    int m1;
    for (int i = 0; i < 3; i++) {
        cin >> m1;
        if (m1 == 5)
            five++;
        else if (m1 == 7)
            seven++;
    }

    if (five == 2 && seven == 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 10000
#define NIL -1

struct Node { int p , l , r;};

struct Node T[MAX];

int n;

//先行
void preParse(int u)
{
	if( u == NIL)
	{
		return;
	}
	printf(" %d",u);
	preParse(T[u].l);
	preParse(T[u].r);
}

//中間
void inParse(int u)
{
	if( u == NIL) 
	{
		return;
	}
	inParse(T[u].l);
	printf(" %d",u);
	inParse(T[u].r);
}

//後行
void postParse(int u)
{
	if(u == NIL) 
	{
		return;
	}
	postParse(T[u].l);
	postParse(T[u].r);
	printf(" %d",u);
}

int main()
{
	int i , v , l , r , root;
	scanf("%d",&n);
	
	for( i = 0; i < n; i++)
	{
		T[i].p = NIL;
	}
	
	for( i = 0; i < n; i++)
	{
		scanf("%d %d %d",&v,&l,&r);
		T[v].l = l;
		T[v].r = r;
		if( l != NIL)
		{
			T[l].p = v;
		}
		if( r != NIL) 
		{
			T[r].p = v;
		}	
	}
	
	for( i = 0; i < n; i++) 
	{
		if(T[i].p == NIL) 
		{
			root = i;
		}
	}
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
	
	return 0;
}



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

namespace ABC075_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var H = int.Parse(input[0]);
            var W = int.Parse(input[1]);
            var S = new string[H];
            for (int i = 0; i < H; i++)
            {
                S[i] = Console.ReadLine();
            }

            var newS = "";
            for (int i = 0; i < H; i++)
            {
                if (!S[i].Contains('.'))
                {
                    continue;
                }
                for (int j = 0; j < W; j++)
                {
                    
                    if (S[i][j] == '.')
                    {
                        var count = 0;
                        for (int k = i - 1; k <= i + 1; k++)
                        {
                            if (k < 0 || k >= H)
                            {
                                continue;
                            }

                            for (int l = j - 1; l <= j + 1; l++)
                            {
                                if (l < 0 || l >= W)
                                {
                                    continue;
                                }

                                if (S[k][l] == '#')
                                {
                                    count++;
                                }
                            }
                        }
                        newS += count.ToString();
                    }
                    else
                    {
                        newS += '#';
                    }
                    
                }
                S[i] = newS;
                newS = "";
            }
            for (int i = 0; i < H; i++)
            {
                Console.WriteLine(S[i]);
            }
        }
    }
}


Measured memory_bytes: 13268
#include <stdio.h>

int main(void)
{
  int x, i;


  while(1){
        scanf("%d %d",&x,&i);
        if(x == 0 && i == 0)
           break;
  
  if(x>i)
    printf("%d %d\n",i,x);
  else
    printf("%d %d\n",x,i);


}
return 0;
}


Measured memory_bytes: 1972
[N,K] = list(map(int,input().split()))
V = list(map(int,input().split()))
C = [0]*(N+1)
for i in range(N):
  C[i+1] = C[i]+V[i]
ans = 0
for i in range(N+1):
  for j in range(N+1):
    if i+j > K or i+j > N:
      continue
    sum = C[i]+(C[N]-C[N-j])
    rem = K-i-j
    v = []
    for k in range(i):
      if V[k] < 0:
        v.append(V[k])
    for k in range(j):
      if V[N-1-k] < 0:
        v.append(V[N-1-k])
    v = sorted(v)
    for k in range(min(rem,len(v))):
      sum -= v[k]
    ans = max(ans,sum)
print(ans)

Measured memory_bytes: 3064
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[] array = new int[n];
        for (int i=0; i<m; i++) {
            int a = sc.nextInt() -1;
            int b = sc.nextInt() -1;
            array[a] = array[a]+1;
            array[b] = array[b]+1;
        }
        for (int i=0; i<n; i++) {
            System.out.println(array[i]);
        }
    }
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

typedef long long ll;

void solve(long long N, std::vector<long long> P, std::vector<long long> Q)
{
    vector<long long> a(N);
    rep(i, N) a[i] = i + 1;
    map<vector<long long>, int> mp;
    do
    {
        mp[a] = mp.size();
    } while (next_permutation(a.begin(), a.end()));
    int ans = abs(mp[P] - mp[Q]);
    cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> P(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &P[i]);
    }
    std::vector<long long> Q(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &Q[i]);
    }
    solve(N, std::move(P), std::move(Q));
    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;

bool isPrime(int n);

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

    while(true){
        if(isPrime(x)){
            cout << x << endl;
            return 0;
        }
        x++;
    }
    return 0;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  
  int64_t ans = 0;
  
  for (int tmp = 0; tmp < (1 << (S.size()-1)); tmp++) {
    int64_t num = S.at(0) - '0';
    for (int i = 0; i < (S.size()-1); i++) {
      if (tmp & (1 << i)) {
        ans += num;
        num = 0;
      }
      num = num*10 + S.at(i+1) - '0';
    }
    
    ans += num;
  }
  
  cout << ans << endl;
        

}

Measured memory_bytes: 3568
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define R(s) reverse(s,s+strlen(s))
#define C(s) (!s[1]||s[0]-'0')
void F(char*p,char c)
{
	for(;p=strchr(p,'X');++p)
		*p=c;
}
int main()
{
	char s[128];
	while(scanf("%s",s)>0)
	{
		char a[128]="",b[128]="",c[128]="",i,n;
		for(n=0;n<=9;++n)
		{
			sscanf(s,"%[^+]+%[^=]=%s",a,b,c);
			F(a,n+'0');
			F(b,n+'0');
			F(c,n+'0');
			if(C(a)&&C(b)&&C(c))
			{
				R(a);
				R(b);
				R(c);
				int f=1,g=1;
				char d[128]="";
				for(i=0;;++i)
				{
					if(f)f=a[i];
					if(g)g=b[i];
					if(!f&&!g)break;
					if(d[i])d[i]-='0';
					if(f)d[i]+=a[i]-'0';
					if(g)d[i]+=b[i]-'0';
					if(d[i]>9)d[i+1]+='0'+d[i]/10, d[i]%=10;
					d[i]+='0';
				}
				if(!strcmp(c,d))goto N;
			}
		}
		puts("NA");continue;
N:;printf("%d\n",n);
	}
	return 0;
}

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

using namespace std;

const int maxn = 200010;
long long int n, num, cnt = 1, ans = 0;

int main()
{
    cin>>n;
    for(int i = 1; i <= n; i ++) {
        cin>>num;
        if(num == cnt) {
            cnt ++;
        }
        else ans ++;
    }
    if(ans != n) cout<<ans;
    else cout<<"-1";
    return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin >> n;
	int r = INT_MAX;
	int m = INT_MAX;
	int M = 0;
	int ans = -1000000000;
	for (int i = 0; i < n; i++) {
		m = min(m, r);
		cin >> r;
		ans = max(r - m, ans);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3220
def num2alpha(num):
    if num <= 26:
        return chr(64+num)
    elif num%26 == 0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

n = int(input())
ans = num2alpha(n)
print(ans.lower())

Measured memory_bytes: 9180
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
  
/*------------------------------------------------------------------*/

int main(){
    int n, k; cin >> n >> k;
    int r, s, p; cin >> r >> s >> p;
    string t; cin >> t;

    int ans = 0;
    int m = t.size();
    rep(i, m){
        if(i >= k){
            if(t[i] == 's'){
                if(t[i - k] != 's'){
                    ans += r;
                }else{
                    t[i] = 'f'; 
                }
            }else if(t[i] == 'p'){
                if(t[i - k] != 'p'){
                    ans += s;
                }else{
                    t[i] = 'f';
                }
            }else if(t[i] == 'r'){
                if(t[i - k] != 'r'){
                    ans += p;
                }else{
                    t[i] = 'f';
                }
            }
        }else{
            if(t[i] == 's') ans += r;
            else if(t[i] == 'p') ans += s;
            else if(t[i] == 'r') ans += p;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
static const int Y = 365;
static const int MAXN = 2*Y+2;

template <class Flow, class Cost>
struct edge
{
  int index;
  Flow capacity, flow;
  Cost cost;
  int back;
  edge(int i, Flow c, Cost d, int b) : index(i), capacity(c), flow(0), cost(d), back(b) {}
};

template <class Flow, class Cost>
void make_edge(vector<edge<Flow, Cost> > *g, int src, int dst, Flow c, Cost d)
{
  const int i = g[src].size(), j = g[dst].size();
  g[src].push_back(edge<Flow, Cost>(dst, c, d, j));
  g[dst].push_back(edge<Flow, Cost>(src, 0, -d, i));
}

template <class Flow, class Cost>
pair<Flow, Cost>
primal_dual(vector<edge<Flow, Cost> > *g, int N, int source, int sink, int max_flow)/*{{{*/
{
  pair<Flow, Cost> total;
  static Cost h[MAXN], dist[MAXN];
  static pair<int,int> parent[MAXN];
  for (Flow f = max_flow; f > 0; ) {
    fill_n(dist, N, 1000000);
    dist[source] = 0;
    fill_n(parent, N, make_pair(-1, -1));
    priority_queue<pair<Cost,int> > q;
    q.push(make_pair(0, source));
    while (!q.empty()) {
      const int n = q.top().second;
      const Cost c = -q.top().first;
      q.pop();
      if (dist[n] < c) {
        continue;
      }
      for (typename vector<edge<Flow, Cost> >::const_iterator it = g[n].begin(); it != g[n].end(); ++it) {
        if (it->capacity - it->flow > 0) {
          const Cost c2 = c + it->cost + h[n] - h[it->index];
          if (c2 < dist[it->index]) {
            dist[it->index] = c2;
            parent[it->index] = make_pair(n, it - g[n].begin());
            q.push(make_pair(-c2, it->index));
          }
        }
      }
    }
    if (parent[sink].first == -1) {
      break;
    }

    Flow e = f;
    for (int i = sink; i != source; i = parent[i].first) {
      const edge<Flow, Cost>& x = g[parent[i].first][parent[i].second];
      e = min(e, x.capacity - x.flow);
    }
    for (int i = sink; i != source; i = parent[i].first) {
      edge<Flow, Cost>& x = g[parent[i].first][parent[i].second];
      total.second += e * x.cost;
      x.flow += e;
      g[x.index][x.back].flow -= e;
    }
    f -= e;
    total.first += e;
    for (int i = 0; i < N; i++) {
      h[i] += dist[i];
    }
  }

  return total;
}/*}}}*/

int main()
{
  int N;
  while (scanf("%d", &N) == 1 && N != 0) {
    static vector<edge<int,int> > g[MAXN];
    for (int i = 0; i < MAXN; i++) {
      g[i].clear();
    }
    for (int i = 0; i < N; i++) {
      int u, v, w;
      scanf("%d %d %d", &u, &v, &w);
      make_edge(g, 2*u-1, 2*v, 1, -w);
    }
    for (int i = 0; i < MAXN-1; i++) {
      make_edge(g, i, i+1, 2, 0);
    }

    printf("%d\n", -primal_dual(g, MAXN, 0, MAXN-1, 2).second);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int a,b;
    scanf("%d%d",&a,&b);
    if(a+b==15){
        cout << '+' << endl;
    }else if(a*b==15){
        cout << '*' << endl;
    }else{
        cout << 'x' << endl;
    }

    return 0;
}
 
 


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

int main(){
  int S;
  cin >>S;
  int h=S/3600;
  int m=S/60 - 60 * h ;
  int s=S - 60 * m - 3600 * h;
  cout <<h<<":"<<m<<":"<<s<<endl;
}



Measured memory_bytes: 3108
#include <iostream>

using namespace std;

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

    string S;
    cin >> S;
    cout << S;
    if (S[S.length() - 1] == 's'){
        cout << "es\n";
    }
    else cout << "s\n";    

}

Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#define llint long long

using namespace std;

llint n, m;
llint a[200005];
vector<llint> vec[2000005];
llint ans[2000005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n-1; i++) cin >> a[i];
	
	for(int i = 0; i < 2000005; i++) vec[i].push_back(i);
	llint sum = 0;
	for(int i = n-1; i >= 3; i--){
		for(int j = sum; j < sum + a[i]; j++){
			llint dest = 2*(sum+a[i])-j;
			if(vec[j].size() > vec[dest].size()) swap(vec[j], vec[dest]);
			for(int k = 0; k < vec[j].size(); k++) vec[dest].push_back(vec[j][k]);
		}
		sum += a[i];
	}
	for(int i = 0; i < 2000005; i++){
		for(int j = 0; j < vec[i].size(); j++){
			ans[vec[i][j]] = i - sum;
		}
	}
	
	cin >> m;
	llint x;
	for(int q = 0; q < m; q++){
		cin >> x;
		if(x > 1000000) cout << x - sum + a[1] - a[2] << "\n";
		else cout << ans[x] + a[1] - a[2] << "\n";
	}
	flush(cout);
	
	return 0;
}

Measured memory_bytes: 165840
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>; 

int main() {
    ll N;
    cin >> N;
    ll ans = 0;
    FOR(i, 1, N+1){
        if(i % 5 != 0 && i % 3 != 0 && i % 15 != 0){
            ans += i;
        }
    }
    cout << ans;
}


Measured memory_bytes: 3640
function Main(input) {
    input = input.split('\n');
    var n = parseInt(input[0], 10);
    var testNum = input.slice(1, n+1);
    var mochi = new Set(testNum);
    console.log('%d',mochi.size);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
import math
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
Alice = []
Bob = []
for i in range (N):
  if i % 2 == 0:
    Alice.append(a[i])
  else:
    Bob.append(a[i])
print(sum(Alice)-sum(Bob))

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

int main() {
        int n, y;
        cin >> n >> y;
        int ans[3] = {-1, -1, -1};

        int i, j, k;
        int sum;
        for(i = 0; i < n + 1; i++)
                for(j = 0; j < n - i + 1; j++) {
                        k = n - i - j;
                        sum = i*10000 + j*5000 + k*1000;
                        if (sum == y) {
                                ans[0] = i;
                                ans[1] = j;
                                ans[2] = k;
                        }
                }
        cout << ans[0] << " ";
        cout << ans[1] << " ";
        cout << ans[2];
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define _size(X) (int)((X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};


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

  string S;
  cin >> S;

  int ans = 0;
  for (int i = 0; i < S.size(); ++i) {
      int tmp = 0;
      for (int j = i; j < S.size(); ++j) {
          if (S[j] == 'A' || S[j] == 'T' || S[j] == 'G' || S[j] == 'C') {
              ++tmp;
          } else {
              break;
          }
      }
      ans = max(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

bool isPrime(int x);

int main(){
	int N,x,cnt=0;
	cin >> N;
	for(int i=0; i<N; i++){
		cin >> x;
		if(isPrime(x)){
			cnt++;
		}
	} 
	cout << cnt << endl;
	return 0;
}

bool isPrime(int x){
	bool prime=false;
	int i=3;
	if(x == 1){
	}else if((x == 2) || (x == 3)){
		prime =true;
	}else if((x%2) == 0){
	}else{
		while(i < x){
			if((x%i) == 0){
				break;
			}else if(i > sqrt(x)){
				prime = true;
				break;
			}
			i = i+2;
		}
	}
	return prime;
}

Measured memory_bytes: 1164
#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++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1<<30;
#define vec2(a,y,x) vector<vector<int>> a(y,vector<int>(x,0))
#define vec1(a,n) vector<int> a(n);rep(i,n)cin>>a[i]
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

int main(){
  int n;
  cin>>n;
  cout<<3*n*n;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
    x = 0; char c = getchar(); int f = 0;
    for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
    for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
    if (f) x = -x;
}

int main(void) {
    int n;
    read(n);
    vector < pair <int, int> > ans;
#define answer(x, y) ans.push_back({x, y});
    if (n & 1) {
        rep (i, n - 1) answer(i, n);
        rep (i, n - 1)
            rep (j, n - 1) if (i + j != n && i < j) answer(i, j);
    } else {
        ++n;
        rep (i, n - 1)
            rep (j, n - 1) if (i + j != n && i < j) answer(i, j);
    }
    cout << ans.size() << "\n";
    for (auto i : ans)
        cout << i.first << " " << i.second << "\n";
}


Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
int main() {
	int n, i;
	int *array;
	scanf("%d", &n);
	array = (int *)malloc(sizeof(int)*n);

	for (i = 0; i < n; i++)
		scanf("%d", &array[i]);
	for (i=n-1;i!=0;--i)
	printf("%d ", array[i]);
	printf("%d\n",array[0]);
	free(array);
	return 0;
}

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

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int [] Alp = new int[26];
    int [] count = new int[26];
    Arrays.fill(count, 0);
    int k;
    Alp[0] = 'a';
    for(int i=1;i<26;i++){
      Alp[i] = Alp[0] + i;
    }
    while(sc.hasNext()){
      String sen = sc.next();
      sen = sen.toLowerCase();
      for(int i=0;i<sen.length();i++){
        k = sen.charAt(i);
        for(int j=0;j<26;j++){
          if(Alp[j] == k){
            count[j]++;
          }
        }
      }
    }
    sc.close();
    for(int i=0;i<26;i++){
      System.out.println((char)Alp[i] + " : " + count[i]);
    }
  }
}


Measured memory_bytes: 26124
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::HashMap;
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::usize;

#[allow(unused_macros)]
macro_rules! read_cols {
    ($($t:ty),+) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();

        let mut it = line.trim()
            .split_whitespace();

        ($(
            it.next().unwrap().parse::<$t>().ok().unwrap()
        ),+)
    }}
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

const M: i64 = 1000000007;

fn mpow(x: i64, n: usize) -> i64 {
    if n == 0 {
        return 1;
    } else if n == 1 {
        return x;
    }

    let q = mpow(x, n / 2);

    q * q % M * mpow(x, n % 2) % M
}

fn main() {
    let n: usize = read();

    let ans = (mpow(10, n) + 2 * (M - mpow(9, n)) + mpow(8, n)) % M;
    println!("{}", ans);
}


Measured memory_bytes: 2160
/*
Author : icewizard99
Created: 17:59:34 27-06-2020
*/

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

#define ll long long
#define int long long int
#define ull unsigned long long
#define FastAF ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ff first
#define ss second
#define pb push_back
#define FOR(a,L,R) for(int i=L;i<R;i++)
#define all(v) v.begin(),v.end()
#define rev(v) reverse(all(v))
#define sot(v) sort(all(v))
#define printa(a,L,R) for(int i=L;i<R;i++) cout<<a[i]<<(i==R-1?'\n':' ')
#define printv(a) printa(a,0,a.size())
#define print2d(a,row,col) for(int i=0;i<row;i++) for(int j=0;j<col;j++) cout<<a[i][j]<<(j==col-1?'\n':' ')
#define mem(a,x) memset(a,x,sizeof(a))


int32_t main(){
    FastAF;

    ll n;
    cin>>n;
    ll tot = 0;
    FOR(i, 1, n+1){
        tot += (i * ((n/i) * ((n/i)+1))/2); 
    }
    cout<<tot;
    return 0;
}



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

void solve(int n) 
{
	string ans = "";
	while(n > 0) {
		if(n % 10 == 7) {
			ans = "Yes";
			break;
		} else {
			n = n / 10;
		}
	}
	if(ans == "Yes") {
		cout << ans;
	} else {
		cout << "No";
	}
}

int main() 
{
	int T = 0;
	cin >> T;
	
	solve(T);
	
	return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <math.h>

int main()
{
	double D,d,a,b,x,y;
	while(scanf("%lf", &D), D)
	{
		scanf("%lf%lf%lf%lf",&a,&b,&x,&y);
		
		d=hypot(a,b);
		if(a*x+b*y>0)d=2.0-d;

		fabs(a*y-b*x)>1e-7||D<d?puts("impossible"):printf("%.8lf\n", d);
	}
}

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

int main() {
  int n;
  cin >> n;
  int k = floor(sqrt(2 * n)) + 1;
  if ((k - 1) * k == 2 * n) {
    vector<vector<int>> a(k);
    for (int i = 0, e = 1; i < k; i++) {
      for (int j = i + 1; j < k; j++, e++) {
        a[i].push_back(e);
        a[j].push_back(e);
      }
    }
    cout << "Yes" << endl;
    cout << k << endl;
    for (auto s : a) {
      cout << s.size() << " ";
      for (auto e : s) {
        cout << e << " ";
      }
      cout << endl;
    }
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 2304
#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() {
  string s;
  int k;
  cin >> s >> k;
  set<string> substrs;
  rep(si, s.size()) {
    for (int l = 1; l <= k; ++l) {
      if (si + l - 1 >= s.size()) break;
      string str = "";
      rep(i, l) str += s[si+i];
      substrs.insert(str);
    }
  }
  // for (auto itr = substrs.begin(); itr != substrs.end(); ++itr) cout << *itr << endl;
  auto itr = substrs.begin();
  rep(i, k-1) ++itr;
  cout << *itr << endl;
  return 0;
}

Measured memory_bytes: 4720
main = do
  s <- getContents
  let ss = init $ lines s
  mapM_ (putStrLn . toString . comp . map read . words) ss
  

toString :: (Integer,Integer) -> String
toString (x,y) = (show x) ++ " " ++ (show y)

comp :: [Integer] -> (Integer,Integer)  
comp (x:y:[])
  | x > y  = (y,x)
  | x <= y = (x,y)

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

int n,m;
int f[3005][3005];
char a[3005],b[3005];

int main()
{
	scanf("%s",a+1);
	scanf("%s",b+1);
	n = strlen(a+1);
	m = strlen(b+1);
	for(int i=n;i>=1;i--)
		for(int j=m;j>=1;j--)
			if(a[i]==b[j])
				f[i][j] = f[i+1][j+1]+1;
			else
				f[i][j] = max(f[i][j+1],f[i+1][j]);
	int p1=1,p2=1;
	while(p1<=n && p2<=m)
	{
		if(a[p1]==b[p2])
		{
			cout<<a[p1];
			p1++;
			p2++;
		}
		else if(f[p1][p2]==f[p1+1][p2])
			p1++;
		else
			p2++;
	}
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 35456
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        List<Integer> list = new ArrayList<>();
        if (s.charAt(0) == '0') {
            list.add(0);
        }
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (i == 0 || s.charAt(i) == s.charAt(i - 1)) {
                cnt++;
            } else {
                list.add(cnt);
                cnt = 1;
            }
        }
        list.add(cnt);
        if (list.size() % 2 == 0) {
            list.add(0);
        }
        int ans = 0;
        int[] sum = new int[list.size() + 1];
        for (int i = 0; i < list.size(); i++) {
            sum[i + 1] = sum[i] + list.get(i);
        }
        for (int i = 0; i < list.size(); i += 2) {
            int left = i;
            int right = Math.min(i + k * 2 + 1, list.size());
            int num = sum[right] - sum[left];
            ans = Math.max(ans, num);
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 28068