akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;

	public class Room
	{
		public int Index{get;set;}
		public int Prev{get;set;}
		public List<int> Path{get;set;}
		public int Distance{get;set;}
	}
	
	public class BFSObj
	{
		public int Index{get;set;}
		public int Prev{get;set;}
		public int Deep{get;set;}
	
	}
	
	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var n = p[0];
		var m = p[1];
		var rooms = new Room[n];
		for(int i = 0; i < n; i++)
		{
			rooms[i] = new Room(){Index=i, Path=new List<int>(), Distance=int.MaxValue};
		}
		
		for(int i = 0; i < m; i++)
		{
			p = Input().ToInt(-1);
			rooms[p[0]].Path.Add(p[1]);
			rooms[p[1]].Path.Add(p[0]);
		}
		
		
		//bfs
		
		var queue = new Queue<BFSObj>();
		queue.Enqueue(new BFSObj(){Index=0, Prev=-1, Deep=0});
		while(queue.Count > 0)
		{
			var o = queue.Dequeue();
			
			if(rooms[o.Index].Distance > o.Deep)
			{
				rooms[o.Index].Distance = o.Deep;
				rooms[o.Index].Prev = o.Prev;
				foreach(var q in rooms[o.Index].Path)
				{
					queue.Enqueue(new BFSObj(){Index=q, Prev=o.Index, Deep=o.Deep+1});
				}
			}
		}
		
		bool all = true;
		for(int i = 1; i < n; i++)
		{
			if(rooms[i].Distance == int.MaxValue)
			{
				all = false;
				break;
			}
		}
		
		if(all)
		{
			Console.WriteLine("Yes");
		for(int i = 1; i < n; i++)
			Console.WriteLine(rooms[i].Prev+1);
			
		}
		else
		{
			Console.WriteLine("No");
		}
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 60804
#include<cstdio>
using namespace std;
char a[55][55];
int dis[55][55];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%s",a[i]+1);
	for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
			int ans=0;
			if(a[i-1][j-1]=='#') ans++;
			if(a[i-1][j]=='#') ans++;
			if(a[i-1][j+1]=='#') ans++;
			if(a[i][j-1]=='#') ans++;
			if(a[i][j+1]=='#') ans++;
			if(a[i+1][j-1]=='#') ans++;
			if(a[i+1][j]=='#') ans++;
			if(a[i+1][j+1]=='#') ans++;
			if(a[i][j]=='#') printf("#");
			else printf("%d",ans);
		}
		putchar('\n');
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long 
int32_t main(){
	int a,b;
	cin>>a>>b;
	if(a<=b){
		while(b--)
			cout<<a;
	}else{
		while(a--)
			cout<<b;
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
  char suit;
  int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int n, int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for ( i = 0; i < n1; i++ ) L[i] = A[left + i];
  for ( i = 0; i < n2; i++ ) R[i] = A[mid + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for ( k = left; k < right; k++ ) {
    if ( L[i].value <= R[j].value) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[], int n, int left, int right) {
  int mid;
  if ( left + 1 < right ) {
    mid = (left + right) / 2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int partition(struct Card A[], int n, int p, int r) {
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p - 1;
  for ( j = p; j < r; j++ ) {
    if ( A[j].value <= x.value ) {
      i++;
      t = A[i]; A[i] = A[j]; A[j] = t;
    }
  }
t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;
  return i + 1;
}

void quickSort(struct Card A[], int n, int p, int r) {
  int q;
  if ( p < r ) {
    q = partition(A, n, p, r);
    quickSort(A, n, p, q - 1);
    quickSort(A, n, q + 1, r);
  }
}

int main() {
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    scanf("%s %d", S, &v);
    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A, n, 0, n);
  quickSort(B, n, 0, n - 1);

  for ( i = 0; i < n; i++ ) {
    if ( A[i].suit != B[i].suit ) stable = 0;
  }

  if ( stable == 1 ) printf("Stable\n");
  else printf("Not stable\n");
  for ( i = 0; i < n; i++) printf("%c %d\n", B[i].suit, B[i].value);

  return 0;
}

Measured memory_bytes: 4952
import sys
from bisect import bisect, bisect_left

sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def get_sieve_of_eratosthenes(n):
	prime = [2]
	limit = int(n**0.5)
	data = [i + 1 for i in range(2, n, 2)]
	append = prime.append
	while True:
		p = data[0]
		if p > limit:
			return prime + data
		append(p)
		data = [e for e in data if e % p != 0]

def main():
	primes = get_sieve_of_eratosthenes(10**5)

	prime_dict = dict(zip(primes, [1]*len(primes)))
	prime_2017 = []
	append = prime_2017.append
	for k in prime_dict.keys():
		if int((k+1)/2) in prime_dict:
			append(k)
	
	prime_2017.sort()
	# print(prime_2017)

	Q = INT()
	for _ in range(Q):
		l, r = MAP()
		print(bisect(prime_2017, r)-bisect_left(prime_2017, l))

if __name__ == '__main__':
	main()

Measured memory_bytes: 6408
#define _GLIBCXX_IOSTREAM
#include<bits/stdc++.h>
#define maxn 300
#define maxm 100100
#define inf 100007
using namespace std;
struct edge{
    int r,nxt,w;
}e[maxm];
int head[maxn],esz=1,S,T,dep[maxn],q[maxn],ql,qr,cur[maxn];
void addedge(int u,int v,int w){
//	printf("[%d->%d]\n",u,v);
    e[++esz].r=v;
    e[esz].nxt=head[u];
    e[esz].w=w;
    head[u]=esz;
    e[++esz].r=u;
    e[esz].nxt=head[v];
    e[esz].w=w;
    head[v]=esz;
}
bool bfs(){
    ql=qr=0;
    q[qr++]=S;
//	printf("[ok,%d,%d]",S,T);
    for(int i=S;i<=T;++i)dep[i]=0,cur[i]=head[i];
    dep[S]=1;
    while(ql<qr){
        int x=q[ql++];
        for(int t=head[x];t;t=e[t].nxt)if(!dep[e[t].r]&&e[t].w)
            dep[e[t].r]=dep[x]+1,q[qr++]=e[t].r;
    }
    return dep[T]!=0;
}
int find(int u,int flow){
    if(u==T)return flow;
    int a=0,used=0;
    for(int& t=cur[u];t;t=e[t].nxt)if(e[t].w&&dep[e[t].r]==dep[u]+1&&(a=find(e[t].r,min(flow-used,e[t].w)))){
        e[t].w-=a;e[t^1].w+=a,used+=a;
        if(used==flow)return used;
    }
    if(!used)dep[u]=0;
    return used;
}
int dinic(){
	int ans=0,a=0;
	while(bfs())
		while(a=find(S,1<<30))ans+=a;
	return ans;
}
int n,m;
char s[maxn][maxn];
int main(){
	scanf("%d%d",&n,&m);
	S=0,T=n+m+1;
	for(int i=1;i<=n;++i){
		scanf("%s",s[i]+1);
		for(int j=1;j<=m;++j){
			if(s[i][j]=='o')addedge(i,j+n,1);
			else if(s[i][j]=='S')addedge(S,i,inf),addedge(S,j+n,inf);
			else if(s[i][j]=='T')addedge(i,T,inf),addedge(j+n,T,inf);
		}
	}
	int x=dinic();
	if(x<=n*m)printf("%d",x);
	else puts("-1");
}

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

using namespace std;

int main(void)
{
    int N, M;
    vector<int> Ai;

    int TotalVotes = 0;
    int PopularItems = 0;

    int remain;
    double PopularBorder;

    cin >> N >> M;

    for (int i = 0; i < N; i++)
    {
        cin >> remain;
        TotalVotes += remain;
        Ai.push_back(remain);
    }

    PopularBorder = (double)TotalVotes / (double)(4 * M);

    for (int value : Ai)
        if (value >= PopularBorder)
            PopularItems++;

    cout << ((PopularItems >= M) ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

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

    int n; cin >> n;
    vector<int> g[n];
    rep(i, n-1){
        int a, b;
        cin >> a >> b;
        a--; b--;

        g[a].push_back(b);
        g[b].push_back(a);
    }

    char holder[n];
    fill(holder, holder+n, 'N');
    holder[0] = 'F';
    holder[n-1] = 'S';

    queue<int> que;
    que.push(0);
    que.push(n-1);

    while(!que.empty()){
        int v = que.front();
        que.pop();

        rep(i, g[v].size()){
            int u = g[v][i];
            if(holder[u] != 'N') continue;

            holder[u] = holder[v];
            que.push(u);
        }
    }

    ll cntFennec = 0;
    rep(i, n){
        if(holder[i] == 'F'){
            cntFennec++;
        }
    }

    if(cntFennec > n/2){
        cout << "Fennec" << endl;
    }
    else{
        cout << "Snuke" << endl;
    }
    return 0;
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, T t){return v2<T>(r, vector<T>(c, t));}

void solve(){
    string s;
    cin >> s;
    int n = s.length();

    int ans = 0;
    array<int, 2019> seen = {};
    seen[0] = 1;
    int sum = 0;
    int mult = 1;
    for(int i = n-1; i >= 0; --i){
        sum = (sum + mult*(s[i]-'0')) % 2019;
        ans += seen[sum];
        seen[sum]++;
        mult = (mult*10) % 2019;
    }

    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3752
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
typedef long long ll;
using namespace std;

void solve(){
  string s, ans; cin >> s;
  int x = s[s.size() - 1] - '0';
  if(x == 3) ans = "bon";
  else if(x == 0 || x == 1 || x == 6 || x == 8) ans = "pon";
  else ans = "hon";
  cout << ans << endl;
  return;
}

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


Measured memory_bytes: 3632
//============================================================================
// Name        : JOI.cpp
// Author      :2015 ho3
// Version     :???11:08
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>

using namespace std;
int M,N;
int P[10001];
int C[501];
int E[501];
int MaxM=0;
int TP[10001]={};
const int INF=200000000;
int dp[10001][501]={};

int calc(int a,int b){
	int ans=INF;
	if(b<0)return ans;
	if(a<=0)return 0;
	if(dp[a][b]>-1)return dp[a][b];
	ans=calc(a,b-1);
	if(a<=C[b]){
		ans=min(ans,E[b]);
	}else{
		ans=min(ans,calc(a-C[b],b-1)+E[b]);
	}

	dp[a][b]=ans;
	return ans;
}
int main() {
	cin>>M>>N;
	for(int i=0;i<M;++i)cin>>P[i];
	for(int i=0;i<N;++i)cin>>C[i]>>E[i];

	sort(P,P+M);
	TP[1]=P[M-1];
	for(int i=2;i<M+1;++i){
		TP[i]=TP[i-1]+P[M-i];
	}

	for(int i=0;i<N;++i)MaxM+=C[i];
	MaxM=min(MaxM,M);

	fill(dp[0],dp[10001],-1);
	int R=0;
	for(int i=1;i<MaxM+1;++i){
		R=max(R,TP[i]-calc(i,N-1));
	}
	cout<<R<<endl;
	return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  
  int ans = 1;
  
  for(int i = 0; i < n ; i++) {
    if (ans < k )
      ans*=2;
    else
      ans+=k;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
long long rui(int n) {
	if (n == 0) {
		return 1;
	}
	else {
		long long x = rui(n - 1);
		return 2 * x;
	}
}
int main() {
	int n, m, d; int ans = 0;
	cin >> n >> m >> d;
	vector<vector<int> > sy(n, vector<int>(m, 1));
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < m; j++) {
			if (s[j] == '#') {
				sy[i][j] = 0;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j+d <= m; j++) {
			int x = 1;
			for (int k = j; k < j + d; k++) {
				x *= sy[i][k];
			}
			ans += x;
		}
	}
	for (int j = 0; j < m; j++) {
		for (int i = 0; i + d <= n; i++) {
			int x = 1;
			for (int k = i; k < i + d; k++) {
				x *= sy[k][j];
			}
			ans += x;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3204
N = int(input())
A = list(map(int, input().split(" ")))

count = {}
ans = 0
for i in range(N):
    if (i - A[i]) in count:
        ans += count[i - A[i]]

    if (i + A[i]) in count:
        count[i + A[i]] += 1
    else:
        count[i + A[i]] = 1
print(ans)

Measured memory_bytes: 40340
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	string X, Y; cin >> X >> Y;
    if(X == Y) {
        cout << "=" << endl;
        return 0;
    }
	cout << (X < Y?"<":">") << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] Ls = new int[M];
        int[] Rs = new int[M];

        for (int i=0; i<M; i++) {
            Ls[i] = sc.nextInt();
            Rs[i] = sc.nextInt();
        }

        Arrays.sort(Ls);
        Arrays.sort(Rs);

        int min = Ls[M-1];
        int max = Rs[0];

        int count = 0;
        for (int i=1; i<N+1; i++) {
            if (min <= i && i <= max) {
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 86708
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

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

    int n, k;
    cin >> n >> k;
    ll ans = 0;
    if(k % 2 == 0){
        for(int a = k / 2; a <= n; a += k / 2){
            if(a % k == 0){
                int cnt = n / k;
                ans += (ll)cnt * cnt;
            }
            else{
                int cnt = n / (k / 2) - n / k;
                ans += (ll)cnt * cnt;
            }
        }
    }
    else{
        for(int a = k; a <= n; a += k){
            int cnt = n / k;
            ans += (ll)cnt * cnt;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,N,key,max=-99999,min;
  int x=0;
  int A[200001];

  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",&A[i]);

  max=A[1]-A[0];
  min=A[0];
  
  for(i=1;i<N;i++){
    if(min>A[i]){
      min=A[i];
      continue;
    }
    if(A[i]<=A[i+1]) continue;
    if(A[i]-min>max) max=A[i]-min;
  }
 
  printf("%d\n",max);
    
  return 0;
}



Measured memory_bytes: 2584
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ll n;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	reverse(a,a+n);
	ll ans=0;
	for(int i=0;i<n;i++){
		ans+=a[i/2];
	}
	ans-=a[0];
	cout<<ans<<endl;
}


Measured memory_bytes: 5176
n, k, q = [int(x) for x in input().split()]
a = []
for i in range(q):
    a.append(int(input()))

a_dict = dict((x, 0) for x in range(1, n + 1))
for i in range(q):
    a_dict[a[i]] += 1

for i in range(n):
    tmp = k - (q - a_dict[i + 1])
    if tmp > 0:
        ans = 'Yes'
    else:
        ans = 'No'
    print(ans)

Measured memory_bytes: 19104
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> vi,sor;
	for(int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		vi.push_back(a); 
	} 
	sor = vi;
	sort(sor.begin(),sor.end());
	int sum = 0;
	for(int i=0;i<sor.size();i++)
	{
		if(sor[i]!=vi[i])
		sum++;
	}
	if(sum == 0||sum == 2)
	{
		cout<<"YES\n";
	}
	else
	{
		cout<<"NO\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define MP(a,b) make_pair(a,b)
typedef long long LL;
typedef pair<int, int> PI;
typedef vector<int> VI;
const LL MOD = 1000000007LL;
LL A[100000];
int main() {
	int N;
	cin >> N;
	rep(i, N) cin >> A[i];
	int ans = 1;
	int type = 0;
	if (A[0] < A[1]) type = 1;
	else if (A[0] > A[1]) type = -1;
	REP(i, 1, N-1) {
		if (A[i] < A[i + 1]) {
			if (type == -1) ans++, type = 0;
			else type = 1;
		}
		else if (A[i] > A[i + 1]) {
			if (type == 1) ans++, type = 0;
			else type = -1;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
use std::io::*;

fn main() {
    let a = read();

    let m = a / 15 * 200;
    println!("{}", a * 800 - m);
}

// fn read_v() -> Vec<char> {
//     let s = stdin();
//     //    let mut s = BufReader::new(s.lock());
//     let b = s.bytes()
//         .map(|c| c.unwrap() as char)
//         .take_while(|c| !c.is_whitespace())
//         .collect();
//     b
// }

// fn read_t() -> (u32, u32) {
//     let mut s = String::new();
//     stdin().read_line(&mut s).expect("failed read_t");
//     let mut i = s.split_whitespace().map(|c| c.parse().ok().unwrap());
//     (i.next().unwrap(), i.next().unwrap())
// }

fn read() -> u32 {
    let s = stdin();
    //    let mut s = BufReader::new(s.lock());
    let b = s.bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    b.parse().ok().expect("read() failed")
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<queue>

#define rep(i,x) for(ll i=0;i<(int)(x);i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::pair<ll, ll> P;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

using namespace std;

int main()
{
    ll n, k;
    string s;
    cin >> n >> k;
    cin >> s;

    string p = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string q = "abcdefghijklmnopqrstuvwxyz";

    rep(i, p.size()){
        if(s[k-1] == p[i]){
            s[k-1] = q[i];
        }
    }

    cout << s;

    
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val inputs = readInputLine().split(" ")
    val a = Integer.parseInt(inputs[0])
    val b = Integer.parseInt(inputs[1])
    val t = Integer.parseInt(inputs[2])

    println(t / a * b)
}
 
fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 35948
from itertools import product
S = input().strip()
x = ["","K","I","H","","B","","R",""]
y = [0,4,6,8]
flag=0
for z in product((0,1),repeat=4):
    x1 = x[:]
    for i in range(4):
        if z[i]==1:
            x1[y[i]] = "A"
    x1 = "".join(x1)
    if x1==S:
        flag=1
        break
if flag==1:
    print("YES")
else:
    print("NO")

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, a[100000], b[100000];

int main() {
	cin >> n;
	inc(i, n) { cin >> a[i]; a[i]--; }
	
	b[0] = 1;
	int p = 0, ans = 0;
	do {
		p = a[p];
		ans++;
		if(b[p] != 0) { ans = -1; break; }
		b[p] = 1;
	} while(p != 1);
	
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

//struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}init;

typedef long long LL;
#define fin endl
void chmin(LL &a,LL b){a=min(a,b);}

#define REP(i, n) for(LL i = 0; i < (n); ++i)

int main(){
    LL n,m;
    cin >>n>>m;
    LL ans = 0;
    REP(i, n){
        cout << "lst " << i << endl;
        LL k,_;
        cin >> k;
        REP(j, k) cin >> _;
        ans += k * (k - 1);
    }

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

Measured memory_bytes: 3108
N = list(map(int,input().split()))
list0_9 = [0 for i in range(10)]
for i in N:
  list0_9[i]+=1
if list0_9[1] == list0_9[4] == list0_9[7] == list0_9[9] == 1:
  print("YES")
else:
  print("NO")


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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace
#define mp make_pair


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  int n; cin >> n;
  vi a(n);

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

  ll left, right = 1, sum = a[0];
  for (; left < n; ++left) {
    while (right < n && sum * 2 >= a[right]) {
      sum += a[right];
      ++right;
    }

    if (right >= n) {
      cout << n - left << endl;
      return 0;
    }

    sum += a[right];
    left = right-1;
    ++right;
  }
}


Measured memory_bytes: 3696
import java.util.Arrays;
 
public class Main {
 
  private static void solve() {
    char[] s = ns();
    int n = s.length;
    int AL = 26;
    int[] dp = new int[n + 2];
    Arrays.fill(dp, Integer.MAX_VALUE / 2);
    
    dp[n + 1] = 0;
    dp[n] = 1;
    int[][] g = new int[n + 1][2];
    g[n] = new int[] {0, n + 1};
    
    int[] f = new int[AL];
    Arrays.fill(f, n + 1);
    
    for (int i = n - 1; i >= 0; i --) {
      f[s[i] - 'a'] = i + 1;
      for (int j = 0; j < AL; j ++) {
        if (1 + dp[f[j]] < dp[i]) {
          dp[i] = 1 + dp[f[j]];
          g[i] = new int[] {j, f[j]};
        }
      }
    }
 
    String ret = "";
    for (int i = 0; i < n + 1;) {
      char c = (char)(g[i][0] + 'a');
      ret += c;
      i = g[i][1];
    }
    System.out.println(ret);
  }
 
 
  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = System.getProperty("debug");
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }
 
  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;
 
  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
 
  private static double nd() {
    return Double.parseDouble(next());
  }
 
  private static long nl() {
    return Long.parseLong(next());
  }
 
  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }
 
  private static char[] ns() {
    return next().toCharArray();
  }
 
  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }
 
  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }
 
  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }
 
  private static int ni() {
    return Integer.parseInt(next());
  }
 
  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}

Measured memory_bytes: 99540
N=int(input())
G=[[] for _ in range(N)]
for _ in range(N-1):
    a,b=map(int, input().split())
    a,b=a-1,b-1
    G[a].append(b)
    G[b].append(a)
*C,=map(int, input().split())

C.sort(reverse=True)
ans=[-1]*N

stk=[0]
ans[0]=C[0]
idx=1
while stk:
    v=stk.pop()
    for to in G[v]:
        if ans[to]>0: continue
        ans[to]=C[idx]
        idx+=1
        stk.append(to)

print(sum(C)-C[0])
print(*ans)

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

class Main {
    static Scanner scanner = new Scanner();

    static int dx, dy;
    static boolean swap;
    public static void main(String[]$) {
        int k = scanner.nextInt();
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        dx = x < 0 ? -1 : 1;
        dy = y < 0 ? -1 : 1;
        x = Math.abs(x);
        y = Math.abs(y);
        if (x < y) {
            swap = true;
            int t = x;
            x = y;
            y = t;
        }
        int n = (x + y + k - 1) / k;
        if (k % 2 == 0 && (x + y) % 2 == 1) {
            System.out.println(-1);
            return;
        } else if (x + y < k) {
            if ((x + y) % 2 == 1) {
                System.out.println(3);
                print(x, x - k);
                print(x + (k + x - y) / 2, x - k + (k - x + y) / 2);
                print(x, y);
                return;
            } else {
                n = 2;
            }
        } else if ((k - (x + y) % k) % k % 2 == 1) {
            n++;
        }
        System.out.println(n);
        int m = (k * n - x - y) / 2;
        for (int i = 1; i <= n; i++) {
            if (m > k * i) {
                print(0, -k * i);
            } else if (x + m > k * i) {
                print(k * i - m, -m);
            } else {
                print(x, k * i - 2 * m - x);
            }
        }
    }

    static void print(int x, int y) {
        System.out.println(dx * (swap ? y : x) + " " + dy * (swap ? x : y));
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 32768);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 44012
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <utility>
#include <functional>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n;
    int a, b; cin>>n>>a>>b;
    b^=a;
    int bd[18];
    int ct=0;
    for(int i=0; i<n; i++){
        bd[i]=(b&1);
        b>>=1;
    }
    for(int i=0; i<n; i++){
        if(bd[i]){
            ct++;
        }
    }
    if(ct%2==0){
        cout<<"NO"<<endl;
        return 0;
    }
    vector<int> ind[2];
    for(int i=0; i<n; i++){
        ind[bd[i]].push_back(i);
    }
    cout<<"YES"<<endl;
    vector<int> v[18], w[18];
    v[0].push_back(0);
    v[1].push_back(0); v[1].push_back(1);
    for(int i=2; i<=n-ct; i++){
        for(auto x:v[i-1]) v[i].push_back(x);
        for(int j=v[i-1].size()-1; j>=0; j--){
            v[i].push_back(v[i-1][j]^(1<<(i-1)));
        }
    }
    w[1].push_back(0); w[1].push_back(1);
    for(int i=3; i<=ct; i+=2){
        for(int j=0; j<w[i-2].size(); j++){
            if(j==0){
                w[i].push_back((w[i-2][j]<<2)^0);
                w[i].push_back((w[i-2][j]<<2)^2);
                w[i].push_back((w[i-2][j]<<2)^3);
                w[i].push_back((w[i-2][j]<<2)^1);
            }else if(j%2==0){
                w[i].push_back((w[i-2][j]<<2)^3);
                w[i].push_back((w[i-2][j]<<2)^2);
                w[i].push_back((w[i-2][j]<<2)^0);
                w[i].push_back((w[i-2][j]<<2)^1);
            }else{
                w[i].push_back((w[i-2][j]<<2)^1);
                w[i].push_back((w[i-2][j]<<2)^0);
                w[i].push_back((w[i-2][j]<<2)^2);
                w[i].push_back((w[i-2][j]<<2)^3);
            }
        }
    }
    vector<int> ans;
    for(int j=0; j<w[ct].size(); j++){
        for(int i=0; i<v[n-ct].size(); i++){
            int i1=i;
            if(j%2) i1=(int)v[n-ct].size()-1-i1;
            int x=0;
            for(int k=0; k<n-ct; k++){
                int t=ind[0][k];
                if(v[n-ct][i1]&(1<<k)) x^=(1<<t);
            }
            for(int k=0; k<ct; k++){
                int t=ind[1][k];
                if(w[ct][j]&(1<<k)) x^=(1<<t);
            }
            x^=a;
            ans.push_back(x);
        }
    }
    for(int i=0; i<ans.size(); i++){
        if(i<(int)ans.size()-1) cout<<ans[i]<<" ";
        else cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1692
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int A, B, C, D, E;
	cin >> A >> B >> C >> D >> E;
	int sum = A + B + C + D + E;
	int a, b, c, d, e;

	if (A % 10 == 0) a = 0;
	else a = 10 - A % 10;
	if (B % 10 == 0) b = 0;
	else b = 10 - B % 10;
	if (C % 10 == 0) c = 0;
	else c = 10 - C % 10;
	if (D % 10 == 0) d = 0;
	else d = 10 - D % 10;
	if (E % 10 == 0) e = 0;
	else e = 10 - E % 10;

	vector<int>ans = { a,b,c,d,e };
	sort(ans.begin(), ans.end());
	ans[4] = 0;
	for (int i = 0;i < 5;i++) {
		sum += ans[i];
	}
	cout << sum << endl;
}

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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

int main()
{
    int A, B, T;
    cin >> A >> B >> T;
    int ans = T / A * B;
    cout << ans << endl;
    return 0;
}

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

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

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

    int num = 0;
    for (int i = 0; i < N; i++) {
        int jmin = i;
        for (int j = i + 1; j < N; j++) {
            if (A[j] < A[jmin]) jmin = j;
        }
        if (i != jmin) {
            swap(A[i],A[jmin]);
            num++;
        }
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl << num << endl;
}



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

template <int mod = (int)(1e9 + 7)>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t n) const {
    ModInt res(1), mul(x);
    while (n) {
      if (n & 1) res *= mul;
      mul *= mul;
      n >>= 1;
    }
    return res;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static int get_mod() { return mod; }
};

struct Combination {
  vector<ModInt<>> _fact, _rfact, _inv;
  Combination(long long nsize = 5000000)
      : _fact(nsize + 1), _rfact(nsize + 1), _inv(nsize + 1) {
    _fact[0] = _rfact[nsize] = _inv[0] = 1;
    for (int i = 1; i <= nsize; i++) _fact[i] = _fact[i - 1] * i;
    _rfact[nsize] /= _fact[nsize];
    for (int i = nsize - 1; i >= 0; i--) _rfact[i] = _rfact[i + 1] * (i + 1);
    for (int i = 1; i <= nsize; i++) _inv[i] = _rfact[i] * _fact[i - 1];
  }
  inline ModInt<> fact(int k) const { return _fact[k]; }

  inline ModInt<> rfact(int k) const { return _rfact[k]; }

  inline ModInt<> inv(int k) const { return _inv[k]; }

  ModInt<> P(int n, int r) const {
    if (r < 0 || n < r) return 0;
    return fact(n) * rfact(n - r);
  }

  ModInt<> C(int p, int q) const {
    if (q < 0 || p < q) return 0;
    return fact(p) * rfact(q) * rfact(p - q);
  }
  // n types,choose r
  ModInt<> H(int n, int r) const {
    if (n < 0 || r < 0) return (0);
    return r == 0 ? 1 : C(n + r - 1, r);
  }
};

long long s;
Combination com;

ModInt<> solve();

int main() {
  cin >> s;
  cout << solve() << endl;
  return 0;
}

ModInt<> solve() {
  ModInt<> res;
  for (int i = 1; i <= s; ++i) {
    long long rest = s - 3 * i;
    if (rest < 0) continue;
    res += com.H(i, rest);
  }
  return res;
}

Measured memory_bytes: 61632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll X[25][205];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, D;
    cin >> N >> D;
    ll ans = 0;
    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= D; j++) cin >> X[i][j];
    }
    for(int i = 1; i <= N; i++) {
        for(int j = i + 1; j <= N; j++) {
            ll delta = 0;
            for(int d = 1; d <= D; d++) {
                ll dx = X[i][d] - X[j][d];
                delta += dx * dx;
            }
            if((ll)sqrt(delta) * (ll)sqrt(delta) == delta) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
package main

import (
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	const mod = 998244353
	const mx = 2e5
	F := [mx + 1]int{1}
	for i := 1; i <= mx; i++ {
		F[i] = F[i-1] * i % mod
	}
	pow := func(x, n int) int {
		r := 1
		for ; n > 0; n >>= 1 {
			if n&1 == 1 {
				r = r * x % mod
			}
			x = x * x % mod
		}
		return r
	}
	c := func(n, k int) int { return F[n] * pow(F[k]*F[n-k]%mod, mod-2) % mod }

	var n, m, k, a int
	Fscan(_r, &n, &m, &k)
	for i := 0; i <= k; i++ {
		a = (a + m*c(n-1, i)%mod*pow(m-1, n-1-i)) % mod
	}
	Fprint(_w, a)
}

func main() { run(os.Stdin, os.Stdout) }


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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while (a>0 && c>0){
        c = c-b;
        if(c<=0){
            cout << "Yes" <<endl;
            break;
        }
        a = a-d;
        if(a<=0){
            cout << "No" <<endl;
            break;
        }
    }
    return 0;
}


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

// APG4b-G
int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  string answer = "Balanced";
  if (A+B > C+D) answer = "Left";
  if (A+B < C+D) answer = "Right";
  cout << answer << endl;
  
}


Measured memory_bytes: 256
#C
import numpy as np

n = int(input())

now_min = n
now_min_dex = 1
for i in range(1,int(np.ceil(np.sqrt(n)))+1):

    if n % i == 0:
        #print(i,n // i)
        tmp = (i + n // i)

        if now_min > tmp:
            #print('MIN')
            now_min = tmp
            now_min_dex = i

if now_min_dex == 1:
    print(now_min - 1)
else:
    print(now_min - 2)


Measured memory_bytes: 12424
# /usr/bin/python
# -*- coding: utf-8 -*-
import sys

hw = []
h,w = map(int, input().split())
while h+w > 0:
  hw.append([h,w])
  h,w = map(int, input().split())

for i in range(len(hw)):
  for h in range(hw[i][0]):
    if h in [0, hw[i][0]-1]:
      s = "#" * hw[i][1]
    else:
      s = "#" + "."*(hw[i][1]-2) + "#"
    print(s)
  print()


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, k, t, c=0;
  cin >> n >> k;
  map <ll, ll> a;
  forll(i, 0, n){
	cin >> t;
	a[t]++;
  }
  vecll b;
  for (auto i : a)
	b.push_back(i.second);
  sort(b.begin(), b.end(), greater<ll>());
  while(b.size() > k){
	c += b[b.size() - 1];
	b.pop_back();
  }
  cout << c << endl;
}


Measured memory_bytes: 14964
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long a, b;
  string op;
  cin >> a >> op >> b;
  if (op == "+") cout << a + b << endl;
  else cout << a - b << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
const ll INF = 114514810;
const ll MOD = 1000000007;
int ctoi(const char c){
    switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
  }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, T, ci, ti, co=1000;
    bool fl = false;
    cin >> N >> T;
    rep(i, N){
        cin >> ci >> ti;
        if (ci<=co&&ti<=T){
            co = ci;
            fl = true;
        }
    }
    if (fl){
        cout << co << endl;
    }else{
        cout << "TLE" << endl;
    }
}


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

int main(){
    long long ans = 0;
    
    long long n, c;
    cin >> n >> c;
    
    vector<long long> x(n+2);
    vector<long long> v(n+1);
    x[0] = 0;
    x[n+1] = c;
    v[0] = 0;
    for (int i = 1; i<=n; i++){
        cin >> x[i] >> v[i];
    }
    
    vector<long long> turn_right(n);
    turn_right[0] = 0;
    for (int i = 1; i<n; i++){
        turn_right[i] = turn_right[i-1] + v[i] - (x[i] - x[i-1])*2;
    }
    
    long long left_max = 0;
    long long tmp = 0;
    for (int i = n; i>0; i--){
        tmp += v[i] - (x[i+1] - x[i]);
        left_max = max(left_max, tmp);
        ans = max(ans, left_max + turn_right[i-1]);
    }
    
    vector<long long> turn_left(n+2);
    turn_left[n+1] = 0;
    for (int i = n; i>0; i--){
        turn_left[i] = turn_left[i+1] + v[i] - (x[i+1] - x[i])*2;
    }
    
    long long right_max = 0;
    tmp = 0;
    for (int i = 1; i<=n; i++){
        tmp += v[i] - (x[i] - x[i-1]);
        right_max = max(right_max, tmp);
        ans = max(ans, right_max + turn_left[i+1]);
    }
    
    cout << ans << endl;
}



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

template<typename T>
class UF
{
public:
	UF() {
		count = 0;
	}

	void push( T a ) {
		M[a] = count;
		V.push_back( count );
		rank.push_back( 0 );
		count++;
	}

	void unite( T a, T b ) {
		long long int x = find( M[a] );
		long long int y = find( M[b] );
		if( x == y )return;
		if( rank[x] < rank[y] ) {
			V[x] = y;
		} else {
			V[y] = x;
			if( rank[x] == rank[y] )rank[x]++;
		}
	}
	void merge( T a, T b ) {
		unite( a, b );
	}
	bool same( T a, T b ) {
		return find( M[a] ) == find( M[b] );
	}
	long long int group() {
		set<long long int>S;
		for( long long int i = 0; i < V.size(); i++ ) {
			S.insert( find( V[i] ) );
		}
		return S.size();
	}

private:
	vector<long long int> V, rank;
	map < T, long long int>M;
	long long int count;

	long long int find( long long int x ) {
		if( V[x] == x )return x;
		else return V[x] = find( V[x] );
	}
};

int main() {
	long long int n, q;
	cin >> n >> q;
	UF<long long int> uf;
	for( long long int i = 0; i < n; i++ ) {
		uf.push( i );
	}
	for( size_t i = 0; i < q; i++ ) {
		long long int c, x, y;
		cin >> c >> x >> y;
		if( c == 0 ) {
			uf.unite( x, y );
		} else {
			cout << uf.same( x, y ) << endl;
		}
	}
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;

// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (ll)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// ll        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
void dfs(ll v, ll bef, vector<ll> &res, vector<set<ll>> &a, vector<ll> &r, vector<bool>& isadded) {
  debug(v, bef);
  isadded[v] = true;
  bef = bef + r[v];
  res[v] += bef;

  if (SIZE(a[v]) == 0) return;

  for (ll i : a[v]) {
    debug('a', i);
    if(!isadded[i]) dfs(i, bef, res, a, r, isadded);
  }
}

int main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n, q;
  cin >> n >> q;
  vector<set<ll>> a(n, set<ll>());
  rep(i, n - 1) {
    ll tempa, tempb;
    cin >> tempa >> tempb;
    tempa--;
    tempb--;
    a[tempa].insert(tempb);
    a[tempb].insert(tempa);
  }
  vector<ll> r(n, 0);
  rep(i, q) {
    ll temp, tempx;
    cin >> temp >> tempx;
    temp--;
    if (r[temp] == 0)
      r[temp] = tempx;
    else
      r[temp] += tempx;
  }
  rep(i, n) {
    for (auto j : a[i]) {
      debug("tunagi", i, j);
    }
    debug("sum", i, r[i]);
  }
  vector<ll> res(n, 0);
  vector<bool> isadded(n, false);
  dfs(0, 0, res, a, r, isadded);
  rep(i, n) {
    cout << res[i];
    if (i != n - 1) cout << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 49280