akhauriyash/Code-Regression huggingface dataset:
N = int(input())
h = input().split()

def watering(num_list):
    num_list_ = []
    l_ = [str(l-1) for l in map(int, num_list)]
    num_list_.extend(list_split(l_, '0'))

    return num_list_

def list_split(num_list, s):
    list_ = [n if n != s else 'x' for n in num_list]
    return [_.split() for _ in ' '.join(list_).split('x')  if _ is not '' and _ is not ' ']

h_ = list_split(h, '0') 

i = 0
while(1):
    if len(h_) == 0:
        break
    else:
        new_h = []
        for _ in h_:
            new_h.extend(watering(_))
            i += 1
        h_ = new_h
            
print(i)
        

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

int main(){
  int n, m;
  cin>>n>>m;

  int a[100][100];
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++) cin>>a[i][j];

  int b[100];
  for(int i=0;i<m;i++) cin>>b[i];
  int c[100] = {};
  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++) cout<<c[i]<<endl;

  return 0;
}
  


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

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

using namespace std;

int main(){
	int n;
	string s; cin>>n>>s;

	int ans=0;
	rep(i,n){
		bool f1[128]={},f2[128]={};
		rep(j,n){
			if(j<i) f1[s[j]]=true;
			else    f2[s[j]]=true;
		}
		int cnt=0;
		for(char c='a';c<='z';c++) if(f1[c] && f2[c]) cnt++;
		ans=max(ans,cnt);
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
N,M,C = map(int, input().split())

B = list(map(int, input().split()))
ans = 0
for i in range(N):
    sum = C
    A = list(map(int, input().split()))
    for j in range(M):
        sum += (B[j] * A[j])
    if sum > 0:
        ans += 1

print(ans)

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

int main(){
  string str1;
  cin >> str1;
  int n = str1.size(), s, out;
  for(int i = 0; i < n-2; i++)
  {
    s = abs(stoi(str1.substr(i, 3)) - 753);

    if (i == 0) {
      out = s;
    }
    else if (s < out)
    {
      out = s;
    }
  }
  cout << out << endl;  
  
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main()
{
    long n;
    long sum;
    
    n = readln.chomp.to!(long);
    
    for (long i = 1; i <= n; i++) {
        if (i % 15 == 0) {
            continue;
        }
        if (i % 3 == 0) {
            continue;
        }
        if (i % 5 == 0) {
            continue;
        }
        sum += i;
    }
    
    writeln(sum);
}


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

int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=1;i<=n;i++)
    a[i-1] = i;
    int b[n],c[n];
    
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n;i++)
    cin>>c[i];
    int k,j,m=0;
    int flag=1;
    do{
        m++;
        for(int i=0;i<n;i++){
            if(a[i]!=b[i]){
                flag=0;
            }
        }
        
        if(flag==1){
            break;
        }
        else
        flag=1;
        
        
    } while(next_permutation(a,a+n));
    k = m;
    m=0;
    int g[n];
    for(int i=1;i<=n;i++)
    g[i-1]=i;
    
    flag=1;
    do{
        m++;
        for(int i=0;i<n;i++){
            if(g[i]!=c[i]){
                flag=0;
                break;
            }
        }
        
        if(flag==1){
        break;
        }
        else 
        flag=1;
    } while(next_permutation(g,g+n));
    j = m;

    cout<<abs(j-k);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<stack>
using namespace std;
typedef long long ll;

ll n, m, en[100];
char s[101], ans;
const ll mx = 1000010;

ll getNum(ll b, ll e) {
  // [b, e]
  ll temp = 0, counter = 0;
  for (ll i = b; i <= e; i++) {
    if ('0' <= s[i] && s[i] <= '9') {
      temp = temp * 10 + s[i] - '0';
    } else if (s[i] == '(') {
      counter += (temp == 0 ? 1 : temp) * getNum(i+1, en[i] - 1);
      temp = 0;
      i = en[i];
    } else {
      counter += temp == 0 ? 1 : temp;
      temp = 0;
    }
    if (counter > mx) return mx;
  }
  return counter;
}

char check(ll num, ll rest) {
  ll temp = 0;
  for (ll i = num; i < n; i++) {
    if ('0' <= s[i] && s[i] <= '9') {
      temp = temp * 10 + s[i] - '0';
    } else if (s[i] == '(') {
      if (temp == 0) temp = 1;
      ll gn = getNum(i+1, en[i] - 1);
      ll add = temp * gn;
      if (add > rest) {
        return check(i+1, rest % gn);
      }
      rest -= add;
      temp = 0;
      i = en[i];
    } else {
      rest -= temp == 0 ? 1 : temp;
      if (rest < 0) return s[i];
      temp = 0;
    }
  }
}

int main() {
  while (scanf("%s%lld", s, &m), s[0] != '0') {
    n = 0;
    while (s[n] != 0) n++;
    stack<ll> stc;
    for (ll i = 0; i < n; i++) {
      if (s[i] == '(') stc.push(i);
      if (s[i] == ')') en[stc.top()] = i, stc.pop();
    }
    if (getNum(0, n-1) <= m) printf("0\n");
    else printf("%c\n", check(0, m));
  }
}



Measured memory_bytes: 2636
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <set>
#include <string>
#include <cmath>
#include <vector>
#include <map>
using namespace std;

typedef long long ll;

ll fastPow(ll i, ll x)
{
	if (x == 0)return 1LL;
	if (x % 2 == 1)return i*fastPow(i, x - 1);
	else {
		ll ret = fastPow(i, x / 2);
		return ret*ret;
	}
}

int main()
{
	ll n, p;
	cin >> n >> p;
	ll ans = 0;
	if (p == 1) {
		cout << 1;
		return 0;
	}
	if (n == 1) {
		cout << p;
		return 0;
	}
	for (ll i = 1; pow(i, n) <= p; i++) {
		ll D = fastPow(i, n);
		if (p%D == 0)ans = max(ans, i);
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int a, cont = 1;
    scanf("%d", &a);
    printf("Case %d: %d\n", cont, a);
    while (a != 0)
    {
        scanf("%d", &a);
        cont += 1;
        if (a != 0)
        {
            printf("Case %d: %d\n", cont, a);
        }
    }
}


Measured memory_bytes: 2040
import bisect
import sys
sys.setrecursionlimit(10**7)

def dfs(v):
  pos=bisect.bisect_left(dp,arr[v])
  changes.append((pos,dp[pos]))
  dp[pos]=arr[v]
  ans[v]=bisect.bisect_left(dp,10**18)
  for u in g[v]:
    if checked[u]==0:
      checked[u]=1
      dfs(u)
  pos,val=changes.pop()
  dp[pos]=val

n=int(input())
arr=[0]+list(map(int,input().split()))
g=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  g[a].append(b)
  g[b].append(a)
ans=[0]*(n+1)
checked=[0]*(n+1)
checked[1]=1
dp=[10**18 for _ in range(n+1)]
changes=[]
dfs(1)
for i in range(1,n+1):
  print(ans[i])

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

long long f(long long &x,long long &y){
    while(true){
        if(x<y*(y+1)/2) return y-1;
        y++;
    }
}


int main() {
    long long n;
    cin>>n;
    long long ans=0;
    vector<long long> a;
    { long long cnt=0;
    while(n%2==0){
        cnt++;
        n/=2;
    }
    a.push_back(cnt); 
    }
    long long m=n;
    for(long long i=3;i*i<=m;i+=2){
        long long cnt=0;
        while(n%i==0){
            cnt++;
            n/=i;
        }
        if(cnt>0) a.push_back(cnt);
    }
    if(n!=1) a.push_back(1);
    sort(a.begin(),a.end());
    long long mem=1;
    for(int i=0;i<a.size();i++){
        ans+=f(a[i],mem);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  ll A[N];
  for(int i=0;i<N;++i){
    cin>>A[i];
  }
  bool can = true;
  if(A[0]!=0) can = false;
  for(int i=0;i<N-1;++i){
    if(A[i+1]>A[i]+1) can = false;
  }
  if(!can) {
    cout<<-1<<endl;
    return 0;
  }
  else{
    ll ans = 0;
    int index = N-1;
    bool find;
    while(index>0){
      ans += A[index];
      find = false;
      for(int j=index-1;j>=0;--j){
        if(A[j]>=A[j+1]){
          index = j;
          find = true;
          break;
        }
      }
      if(find) continue;
      break;
    }
    cout<<ans<<endl;
    return 0;
  }
}



Measured memory_bytes: 5204
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 1e9
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

int main(){
	int n,k,tmp,ans=INF;
	cin>>n>>k;
	rep(i,n+1){
		tmp=1;
		loop(j,1,n+1){
			if(j<=i){
				tmp*=2;
			}else{
				tmp+=k;
			}
		}
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#13 C - Traveling
N = int(input())

plan = []
for _ in range(N):
    ti,xi,yi = map(int,input().split())
    plan.append((ti,xi,yi))
    
#今いる場所の座標と時間
spot = (0,0,0)#始点
result = 'Yes'
for t,x,y in plan:
    tdiff = t-spot[0]
    xdiff = abs(x-spot[1])
    ydiff = abs(y-spot[2])
    #(x,y)の変化量の和の偶奇と時間の差の偶奇が一致している
    #時間の変化量より(x,y)の変化量の方が小さい
    if (tdiff%2 == (xdiff+ydiff)%2) and ((xdiff + ydiff)<=tdiff):
        '''
        xdiff<=tdiff and ydiff<=t だと(3,3,2)などの範囲外に対応できない
        if (tdiff%2 == (xdiff+ydiff)%2) and (xdiff<=tdiff) and (ydiff<=tdiff):
        '''
        spot = (t,x,y)
    else:
        result = 'No'
        break
print(result)

Measured memory_bytes: 22288
#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
  int id;
  struct node *next;
} *nodePointer;
nodePointer *queueHead;
nodePointer *queueTail;
void enqueue(int,int);
void front(int);
void dequeue(int);
void init(int);
nodePointer make1node(int);
int main(void)
{
  int i;
  int n,q;
  int x1,x2,x3;
  scanf("%d",&n);
  init(n);
  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%d",&x1);
      switch(x1)
        {
        case 0:
          scanf("%d%d",&x2,&x3);
          enqueue(x2,x3);
          break;
        case 1:
          scanf("%d",&x2);
          front(x2);
          break;
        case 2:
          scanf("%d",&x2);
          dequeue(x2);
          break;
        }
    }
  return 0;
}
void enqueue(int t,int x)
{
  nodePointer p=make1node(x);
  if(queueHead[t]==NULL)
    {
      queueHead[t]=p;
      queueTail[t]=p;
    }
  else
    {
      queueTail[t]->next=p;
      queueTail[t]=p;
    }
}
void front(int t)
{
  if(queueHead[t]!=NULL) printf("%d\n",queueHead[t]->id);
}
void dequeue(int t)
{
  if(queueHead[t]!=NULL)
    {
      queueHead[t]=queueHead[t]->next;
      if(queueHead[t]==NULL) queueTail[t]=NULL;
    }
}
void init(int n)
{
  int i;
  queueHead=(nodePointer*)malloc(sizeof(nodePointer)*n);
  for(i=0;i<n;i++) queueHead[i]=NULL;
  queueTail=(nodePointer*)malloc(sizeof(nodePointer)*n);
  for(i=0;i<n;i++) queueTail[i]=NULL;
}
nodePointer make1node(int x)
{
  nodePointer p=(nodePointer)malloc(sizeof(struct node));
  p->id=x;
  p->next=NULL;
  return p;
}


Measured memory_bytes: 7996
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


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

Measured memory_bytes: 3584
//
//  second.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); i++)
#define rep1(i,n) for(int (i) = 1; (i) <= (int)(n); i++)
#define INF 1000000
#define MOD 998244353



int main()
{
    ll N,K;
    cin >> N >> K;
    ll ans = N % K;
    
    ll ans2 = - (ans - K);
    
    cout << min(ans, ans2) << endl;
    
    
    return 0;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	var a int
	var b int

	if sc.Scan() {
		line := sc.Text()
		data := strings.Split(line, " ")
		a, _ = strconv.Atoi(data[0])
		b, _ = strconv.Atoi(data[1])
	}

	x := a * a - b * b
	y := 2 * (a - b)

	if x % y != 0 {
		fmt.Println("IMPOSSIBLE")
	} else {
		fmt.Println(x / y)
	}
}


Measured memory_bytes: 640
a,b,c,d = map(int,input().split())

i = 1
while True:
  if i % 2 == 0:
    a -= d
  else:
    c -= b
  i += 1
  if a <= 0 or c <= 0:
    if a <= 0:
      print('No')
    elif c <= 0:
      print('Yes')
    break

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

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    vector<int> a(n + 2);
    a[0] = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i + 1];
    }
    a[n + 2] = 0;
    for (int i = 0; i < n + 1; i++)
    {
        // cout << abs(a[i] - a[i + 1]) << endl;
        ans += abs(a[i] - a[i + 1]);
    }
    // cout << "ans: " << ans << endl;
    for (int i = 0; i < n; i++)
    {
        cout << ans + abs(a[i] - a[i + 2]) - abs(a[i] - a[i + 1]) - abs(a[i + 1] - a[i + 2]) << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    while(cin >> A >> B, A or B)
    {
        int coins[] = {1000, 500, 100};
        vector<int> cnt(3, 0);
        int M = B - A;
        int pos = 0;
        while(M > 0)
        {
            if(M - coins[pos] >= 0)
            {
                cnt[pos]++;
                M -= coins[pos];
            }
            else pos++;
        }
        for(int i = 2; i >= 0; i--)
        {
            if(i != 2) cout << " ";
            cout << cnt[i];
        }
        cout << endl;
    }
    return 0;
}




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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n,m,cap;
    cin >> n >> m >> cap;
    if(n==0) return 0;
    string src,dest;
    cin >> src >> dest;
    vector<string> u(n),v(n);
    vector<int> d(n);
    map<string,int> idx;
    for(int i=0;i<n;i++){
      cin >> u[i] >> v[i] >> d[i];
      idx.insert({u[i],0});
      idx.insert({v[i],0});
    }
    int co=0;
    for(auto &it:idx){
      it.second=co;
      co++;
    }
    vector<list<pair<int,int>>> e(co);
    vector<bool> sta(co,false);
    int ui,vi;
    for(int i=0;i<n;i++){
      ui=idx[u[i]],vi=idx[v[i]];
      e[ui].push_back({vi,d[i]});
      e[vi].push_back({ui,d[i]});
    }
    string sss;
    for(int i=0;i<m;i++){
      cin >> sss;
      sta[idx[sss]]=true;
    }
    int s=idx[src],t=idx[dest];
    cap*=10;
    vector<vector<int>> dist(co,vector<int>(cap+1,INF));
    priority_queue<pair<int,pair<int,int>>> dijk;
    dijk.push({0,{s,cap}});
    pair<int,pair<int,int>> now;
    int pos,nd,nc;
    while(!dijk.empty()){
      now=dijk.top();
      dijk.pop();
      nd=-now.first;
      pos=now.second.first;
      if(sta[pos]) nc=cap;
      else nc=now.second.second;
      if(dist[pos][nc]==INF){
        dist[pos][nc]=nd;
        for(auto ee:e[pos]){
          if(nc>=ee.second){
            if(dist[ee.first][nc-ee.second]==INF){
              dijk.push({-nd-ee.second,{ee.first,nc-ee.second}});
            }
          }
        }
      }
    }
    int ans=INF;
    for(int i=0;i<=cap;i++){
      ans=min(ans,dist[t][i]);
    }
    if(ans==INF) cout << -1 << endl;
    else cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 51820
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
using namespace std;

int main() {
    array<bool, 300001> is_prime;
    is_prime.fill(true);
    is_prime[0] = is_prime[1] = false;
    for(int i=2; i<=300000; ++i) {
        if(i % 7 != 1 && i%7 != 6) {
            is_prime[i] = false;
        } else if(is_prime[i]) {
            for(int j=i*2; j<=300000; j+=i) {
                is_prime[j] = false;
            }
        }
    }

    int n;
    while(cin >> n, n != 1) {
        vector<int> ret;
        for(int i=6; i<=n; ++i) {
            if(is_prime[i] && n % i == 0) {
                ret.push_back(i);
            }
        }
        cout << n << ":";
        for(auto x : ret) {
            cout << " " << x;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3348
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res

def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b,c = LI()
    c -= a-b
    print(max(0,c))
    return

#B
def B():
    n = I()
    ans = 0
    for i in range(1,n+1):
        s = str(i)
        if len(s)%2:
            ans += 1
    print(ans)
    return

#C
def C():
    n = I()
    h = LI()
    h[0] -= 1
    for i in range(n-1):
        if h[i+1] < h[i]:
            print("No")
            return
        if h[i+1] > h[i]:
            h[i+1] -= 1
    print("Yes")
    return

#D
def D():
    s = S()
    n = len(s)
    ans = [0]*n
    l = 0
    i = 0
    while i < n:
        if s[i] == "L":
            j = i
            while i < n and s[i] == "L":
                i += 1
                l += 1
            if l:
                if (l+j-i)%2:
                    ans[j-1] = l-l//2
                    ans[j] = l//2
                else:
                    ans[j-1] = l//2
                    ans[j] = l-l//2
            l = 0
        else:
            l += 1
            i += 1
    print(*ans)
    return

#E
def E():
    def factor(n):
        if n == 1:
            return [1]
        if n < 4:
            return [1,n]
        i = 2
        res = [1]
        while i**2 <= n:
            if n%i == 0:
                res.append(i)
                if n//i != i:
                    res.append(n//i)
            i += 1
        res.append(n)
        res.sort()
        return res

    n,k = LI()
    a = LI()
    s = sum(a)
    f = factor(s)
    for i in f[::-1]:
        s = 0
        b = [[a[j]%i,-a[j]%i] for j in range(n)]
        b.sort()
        for j in range(n-1):
            b[j+1][0] += b[j][0]
            b[j+1][1] += b[j][1]
        for j in range(n-1):
            if b[j][0] == b[n-1][1]-b[j][1]:
                break
        s = b[j][0]
        if s <= k:
            print(i)
            return
    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    E()


Measured memory_bytes: 45504
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
typedef long long ll;
const int INF = 1001001001;
const int mod = 1000000007;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b)
    {
        cout << c << endl;
    }
    else if (a == c)
    {
        cout << b << endl;
    }
    else
    {
        cout << a << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
int main()
{
	int**paper = new int*[14];
	paper += 2;
	for (int i = -2; i < 12; i++)
	{
		paper[i] = new int[14];
		paper[i] += 2;
	}
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			paper[i][j] = 0;
		}
	}
	while (true)
	{
		int x, y, s;
		char foo;
		std::cin >> x >> foo >> y >> foo >> s;
		if (std::cin.eof())
		{
			break;
		}
		paper[y][x]++;
		paper[y - 1][x]++;
		paper[y][x - 1]++;
		paper[y][x + 1]++;
		paper[y + 1][x]++;
		if (s != 1)
		{
			paper[y - 1][x - 1]++;
			paper[y - 1][x + 1]++;
			paper[y + 1][x - 1]++;
			paper[y + 1][x + 1]++;
		}
		if (s == 3)
		{
			paper[y - 2][x]++;
			paper[y][x - 2]++;
			paper[y][x + 2]++;
			paper[y + 2][x]++;
		}
	}
	int max = -1, white = 0;
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			if (paper[i][j] == 0)
			{
				white++;
			}
			if (max < paper[i][j])
			{
				max = paper[i][j];
			}
		}
	}
	std::cout << white << std::endl;
	std::cout << max << std::endl;
	return 0;
}


Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
        if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}

const int INF = 0x3f3f3f3f;
typedef long long LL;
typedef pair<int, int> pii;
typedef long double LD;


const int N = 1e5 + 100;
char s[N];
int main()  {
	scanf("%s", s);
	int len = strlen(s);
	int ansl = -2, ansr = -2;
	for(int i = 0; i < len; i ++) {
		if(i - 1 >= 0 && s[i - 1] == s[i]) ansl = i - 1, ansr = i;
		if(i - 2 >= 0 && s[i - 2] == s[i]) ansl = i - 2, ansr = i;
	}
	printf("%d %d\n", ansl + 1, ansr + 1);
}


Measured memory_bytes: 384
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        List<Edge>[] graph = Enumerable.Repeat(0, n).Select(_ => new List<Edge>()).ToArray();
        List<Edge> edges = new List<Edge>();
        for (int i = 0; i < n - 1; i++)
        {
            var st = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
            var edge = new Edge() { From = st[0], To = st[1] };
            graph[st[0]].Add(edge);
            graph[st[1]].Add(edge);
            edges.Add(edge);
        }
        var col = graph.Max(x => x.Count);
        Console.WriteLine(col);

        Action<int, int, int> dfs = null;
        dfs = (node, from, fromColor) =>
        {
            int color = 1;
            for (int i = 0; i < graph[node].Count; i++)
            {
                var edge = graph[node][i];
                var to = edge.From ^ edge.To ^ node;
                if (to == from) continue;
                if (color == fromColor) color++;
                edge.Color = color;
                dfs(to, node, color);
                color++;
            }
        };
        dfs(0, int.MaxValue, -1);
        Console.WriteLine(string.Join("\n", edges.Select(x => x.Color)));
    }
}

class Edge
{
    public int From;
    public int To;
    public int Color;
}


Measured memory_bytes: 37336
#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()



using namespace std;



  


int main(){
 ll A,B,N; cin>>A>>B>>N;

 ll prev = -1;

 N = min(N,B-1);
ll x = N;


   ll K1 = A*x/B;
   ll K2 = A *(x/B);

   cout<<K1 - K2<<endl;




  return 0;
}

Measured memory_bytes: 3592
#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;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus>=201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(std::string S){
  ll ans=0;
  if(S=="SUN"){
    ans=7;
  }else if(S=="MON"){
    ans=6;
  }
  else if(S== "TUE"){
    ans=5;
  }
  else if(S=="WED"){
    ans=4;
  }
  else if(S=="THU"){
    ans=3;
  }
  else if(S=="FRI"){
    ans=2;
  }
  else if(S=="SAT"){
    ans=1;
  }
  cout<<ans<<endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
H,W=map(int,input().split())
 
S=[input() for i in range(H)]
R=['' for i in range(H)]

for i in range(H):
  for j in range(W):
    sum=0
    if i!=0:
      #print(i,j,'u',S[i-1][max(0,j-1):min(W,j+2)])
      sum+=S[i-1][max(0,j-1):min(W,j+2)].count('#')
    #print(i,j,'m',S[i][max(0,j-1):min(W,j+2)])
    sum+=S[i][max(0,j-1):min(W,j+2)].count('#')
    if i!=H-1:
      #print(i,j,'l',S[i+1][max(0,j-1):min(W,j+2)])   
      sum+=S[i+1][max(0,j-1):min(W,j+2)].count('#') 
    #print(i,j,sum)
    if S[i][j]=='.':
      R[i]+=str(sum)
    else:      
      R[i]+='#'
    
print(*R,sep='\n')

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    string a, b;
    cin >> n >> a >> b;

    string s;
    for(int i=0; i<n; i++){
        if(a[i] == b[i]){
            s += "1";
        }
        else if(a[i] == a[i+1]) {
            s += "0";
            i++;
        }
    }

    long long tmp = s[0] == '1' ? 1 : 2;
//    int cnt = 0;
    for(int i=1; i<s.length(); i++){
        if(s[i] == '1'){
            if(s[i-1] == '1') tmp *= 2;
        }
        else {
            if(s[i-1] == '1') tmp *= 2;
            else tmp *= 3;
        }
        tmp %= 1000000007;
    }

    cout << tmp * 3 % 1000000007<< endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using LL = long long;
using namespace std;
using Graph = vector<vector<int>>; // グラフ型

void dfs(const Graph& G, int v, vector<int> &state, int state_num) {
	state[v] = state_num; // v を訪問済にする

	// v から行ける各頂点 next_v について
	for (auto next_v : G[v]) {
		if (state[next_v] == -1) {
			dfs(G, next_v, state, state_num); // 再帰的に探索
		}
	}

}


int main() {
	int N, M;
	cin >> N >> M;
	
	Graph G(N + 1);
	for (int i = 0; i < M; i++) {
		int k, l;
		cin >> k >> l;
		G[k].push_back(l);
		G[l].push_back(k);

	}
	vector<int> state(N + 1, -1);
	int state_num = -1;
	for (int i = 1; i <= N; i++) {
		if (state[i] == -1) {
			state_num++;
			dfs(G, i, state, state_num); // 再帰的に探索
		}
	}

	cout << state_num << endl;

	return 0;
}

Measured memory_bytes: 10124
program bott
  implicit none
  integer :: a,b
  integer :: ab(3),mx,i

  read(*,*) a,b
  ab(1)=a+a-1
  ab(2)=b+b-1
  ab(3)=a+b
!  if((aa.gt.))                                                                 
  mx=ab(1)
  do i=2,3
     if(mx.lt.ab(i)) then
        mx=ab(i)
     endif
  enddo
  write(*,'(i0)') mx

end program bott



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll A, B, X;
  cin >> A >> B >> X;
  if (X < A) {
    cout << "NO" << endl;
  } else if (A == X) {
    cout << "YES" << endl;
  } else if (A + B < X) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
  return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define pb push_back
typedef long long ll;
#define int long long
#define ld long double
#define f(i,n) for(ll i=0;i<n;i++)
#define fo(i,a,b) for(ll i=a;i<=b;i++)
#define forr(i,a,b) for(ll i=a;i>=b;i--)
#define ee endl
#define mem(a,b) memset(a,b,sizeof(a))
#define bp __builtin_popcount
#define all(x) (x).begin(),(x).end()
#define s(x) sort(all(x))
#define r(x) reverse(all(x))
#define sz size()
#define ln length()
#define mod 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define pb push_back
#define pf push_front
#define mp make_pair
#define F first
#define S second 
#define mxe(v) *max_element(all(v))
#define vl vector<ll>
#define pll pair<ll,ll>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 
#define KHILADI ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))

ll max(ll a , ll b){ if(a>b) return a; else return b;}
ll min(ll a , ll b){ if(a<b) return a; else return b;}
ll gcd(ll a,ll b){if(a==0)return b;return gcd(b%a,a);}          
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}

void solve(int ttt)
{
    string a,b;
    cin >> a >> b;
    ll cnt=0;
    f(i,a.ln)
        if(a[i]!=b[i])
            cnt++;
    cout << cnt ;
}

signed main()
{
    KHILADI;
    ll test_case=1;
    //cin >> test_case;
    fo(ttt,1,test_case)
    {
        solve(ttt);
    }
    return 0;
}

Measured memory_bytes: 3728
#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define str string
#define sec .second

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30;
ll A[10000][3] = {}, B[1000000] = {}, weight[1000] = {}, value[1000] = {};
ll dp[1000][100002] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, n = 0, su = 0, ma = INF, mi = -1;
double ans;
str S;

bool an = true, bn = false;
long long mod = 1e9 + 7;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Code Line
	cin >> S;
	sort(S.begin(), S.end());
	if (S[0] == S[1] && S[2] == S[3] && S[1] != S[2])cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back


const int N = 2e5 + 51 + 51, MOD = 1e9 + 7, mod = 998244353, INF = 3e18;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;

//gp_hash_table<int, int> table;

int a[N], dp[3000][3000];
bool ok[3000][3000];

signed main() {
    #ifdef Flash
     freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (n % 2 == 1) dp[i][i] = -a[i];
        else dp[i][i] = a[i];
    }
    for (int i = 1; i <= n; i++) {
        int len = n - i, kof = 1;
        if (len % 2 == 0) kof = -1;

        for (int j = 0; j < n; j++) {
            if (i + j >= n) break;
            if (kof == -1) dp[j][i + j] = max(dp[j + 1][i + j] + a[j], dp[j][i + j - 1] + a[i + j]);
            else dp[j][i + j] = min(dp[j + 1][i + j] - a[j], dp[j][i + j - 1] - a[i + j]);
        }
    }
    cout << -dp[0][n - 1];
}


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

int main()
{
    long long int A, B, K;

    cin >> A >> B >> K;

    long long int takahashi = A;
    long long int aoki = B;

    if (K <= A)
    {
        takahashi -= K;
    }
    else if (A < K && K < A + B)
    {
        takahashi = 0;
        aoki -= K - A;
    }
    else if (A + B <= K)
    {
        takahashi = 0;
        aoki = 0;
    }

    cout << takahashi << " " << aoki << endl;

    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N, a;
	while(cin>>N) {
		multiset<ll> S;
		REP(i, N) {
			cin>>a;
			auto it = S.lower_bound(a);
			if(it!=S.begin()) S.erase(--it);
			S.insert(a);
		}
		
		cout<<S.size()<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 4992
using System;
using System.Linq;
class Program
 {
  static void Main(string[] args){
    var lines =  Console.In.ReadToEnd().TrimEnd()
            .Split()
            .Select(n => int.Parse(n))
            .ToArray();
      var mod = lines.Select(n => n%10).ToArray();
      var min = 10;
      var index = 0;
      for(int i = 0; i < 5; i++){
          if(mod[i] < min && mod[i] != 0){
              min = mod[i];
              index = i;
          }
      }
      var times = new int[5];
      for(int i = 0; i < 5; i++){
          if(i == index)
              continue;
          times[i] = (int)(Math.Ceiling((float)lines[i] * 0.1) * 10.0);
      }
      
      int total = 0;
      foreach(var n in times){
          total += n;
      }
      total += lines[index];
      
      Console.WriteLine(total);
  }
 }

Measured memory_bytes: 13396
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
	string s;
	cin >> s;
	int n = s.size();
	int cnt[] = { 0,0,0,0 };
	// east, south, west, north
	FOR(i, 0, n) {
		int c = s[i];
		if (c == 'E')
			cnt[0]++;
		else if (c == 'S')
			cnt[1]++;
		else if (c == 'W')
			cnt[2]++;
		else
			cnt[3]++;
	}
	if ((cnt[0] && !cnt[2]) || (cnt[2] && !cnt[0]) || (cnt[1] && !cnt[3]) || (cnt[3] && !cnt[1]))
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	

	return 0;
}

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

int main(){
  int n,mat[200][3],point[200]={0};

  cin >> n;
  for(int i = 0 ; i < n ; i++)
    for(int j = 0 ; j < 3 ; j++)
      cin >> mat[i][j];

  for(int i = 0 ; i < n ; i++){
    for(int j = 0 ; j < 3 ; j++){
      int cnt = 0;
      for(int l = 0 ; l < n ; l++){
         if(mat[i][j] != mat[l][j] && i != l) cnt++;
       }
       if(cnt == n-1) point[i] += mat[i][j];
    }
  }


  for(int i = 0 ; i < n ; i++){
    cout << point[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 1164
/*Keyence Programming Contest 2020*/
/*A*/
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stack>
#include<vector>
#include<queue>
#include<bitset>
using namespace std;

#define LL long long
#define DB double
#define MOD 59393
#define Pr pair<DB,int>
#define X first
#define Y second
#define MAXN 100000
#define INF 1000000000
#define mem(x,p) memset(x,p,sizeof(x))

LL read(){
  LL x=0,F=1;char c=getchar();
  while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
  while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}
  return x*F;
}

int add(int a,int b){return (a+b>=MOD)?a+b-MOD:a+b;}
int dec(int a,int b){return (a-b<0)?a-b+MOD:a-b;}
int mul(int a,int b){return 1LL*a*b%MOD;}

int n,k,s;
int main()
{
    n=read(),k=read(),s=read();
    if(s==INF){
        for(int i=1;i<=k;i++)
        printf("%d ",INF);
        for(int i=1;i<=n-k;i++)
        printf(" 1");
    }else{
        for(int i=1;i<=k;i++)
        printf("%d ",s);
        for(int i=1;i<=n-k;i++)
        printf("%d ",INF);
    }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
    int K,S;
    cin >> K >> S;
    long long int ans = 0;
    for(int i = 0;i < K + 1;i++){
        for(int j = 0;j < K + 1;j++){
            if(S - i - j >= 0 && S - i - j <= K)  ans++;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define int long long int
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vvi vector<vector<int>>
#define vi vector<int>
#define f first
#define s second
using namespace std;
const int mod = 1e9 + 7;
int logi(int n) {int p = 0; while (n / 2) {n = n / 2; p++;} return p;}
int poww(int x, int y) {int pro = 1; while (y) {if (y & 1)pro = ((pro % mod) * (x % mod) % mod); y = y >> 1; x = ((x % mod) * (x % mod) % mod);} return pro;}
int poww2(int x, int y) {int pro = 1; while (y) {if (y & 1)pro = pro * x; y = y >> 1; x = x * x;} return pro;}
bool isprime(int n) { if (n == 1) return false; for (int i = 2; i <= sqrt(n); i++) if (n % i == 0) return false; return true;}
vector<vector<int>> adj(3e5);
vi visited(3e5, 0);
/*

*/
void dfs(int n, int& cnt)
{
	for (auto i : adj[n])
	{
		if (!visited[i])
		{
			visited[i] = 1;
			cnt++;
			dfs(i, cnt);
		}
	}
}

int solve() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int x, y;
		cin >> x >> y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		int cnt = 0;
		if (!visited[i])
		{
			visited[i] = 1;
			cnt++;
			dfs(i, cnt);
			ans = max(ans, cnt);
		}
	}
	cout << ans;
	return 0;
}
int32_t main() {
	/*#ifndef ONLINE_JUDGE
	    //for getting input from input.txt
	    freopen("input.txt","r",stdin);
	    //for writing output to output.txt
	    freopen("output.txt","w",stdout);
	#endif*/
	fast;
	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}


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

int N;
int B[102];
int sum;

int main() {
  cin >> N;
  rep(i, N-1) {
    cin >> B[i];
  }
  sum += B[0];
  sum += B[N-2];
  for(int i=1; i<N-1; i++) {
    sum += min(B[i], B[i-1]);
  }
  cout << sum << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>

int main()
{
    long long X, K, D;
    std::cin >> X >> K >> D;
    X = std::abs(X);
    if (K <= X / D)
    {
        std::cout << X - K * D << std::endl;
    }
    else
    {
        long long K_ = X / D;
        long long X_ = X - K_ * D;
        if ((K - K_) % 2 == 0)
        {
            std::cout << X_ << std::endl;
        }
        else
        {
            std::cout << -X_ + D << std::endl;
        }
    }
}


Measured memory_bytes: 3516
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>>g;
vector<bool>vis;
void dfs(int s){
	vis[s] = 1;
	for(int nie : g[s]){
		if(!vis[nie]){
			dfs(nie);
		}
	}
}
int main(){
	int n, m; cin>>n>>m;
	g.resize(n+1);
	for(int i=0;i<m;i++){
		int u, v; cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	int ans = 0;
	vis.resize(n+1, 0);
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			ans++;
			dfs(i);
		}
	}
	cout<<ans-1<<endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

ll num[30];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	string a;
	cin>>a;
	ll n=a.size();
	REP(i, n){
		++num[a[i]-'a'];
	}
	ll ans=n*(n-1)/2+1;
	REP(i, 26){
		if(num[i]>1){
			ans-=num[i]*(num[i]-1)/2;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>

int main(){
    int N; cin>>N;
    map<int,int> mp;
    vector<int> v;
    REP(i,N){
        int a; cin>>a;
        ++mp[a];
        if(mp[a]==1){ v.push_back(a); }
    }
    int ans = 0;
    int M = v.size();
    for(int i=0;i<M;++i){
        int x = v[i];
        if(mp[x]%2==1){
            ++ans;
        }else{
            for(int j=i+1;j<M;++j){
                int y = v[j];
                if(mp[y]>1){
                    --mp[y];
                    ++ans;
                    break;
                }
            }
        }
        
    }
    
    cout << ans << "\n";
}

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

namespace AtCoder
{
    class Program2
    {

        static void Main(string[] args)
        {
            var linea = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
            int N = linea[0];
            int M = linea[1];
            var Hs = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
            bool[] buenos = new bool[N];
            for (int i = 0; i < N; i++)
            {
                buenos[i] = true;
            }

            for (int i=0; i<M; i++)
            {
                var conexion = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
                int A = conexion[0] - 1;
                int B = conexion[1] - 1;

                if (Hs[A] > Hs[B])
                {
                    buenos[B] = false;
                }
                else
                {
                    if (Hs[A] < Hs[B])
                    {
                        buenos[A] = false;
                    }
                    else
                    {
                        buenos[A] = false;
                        buenos[B] = false;
                    }
                }
            }

            int respuesta = buenos.Select(x => x).Where(x => x == true).Count();
            Console.WriteLine(respuesta);
        }
    }
}

Measured memory_bytes: 49276