akhauriyash/Code-Regression huggingface dataset:
N,K = [int(x) for x in input().split()]
S = input()
#%%
li = [1]
ans = 0
cnt = 0

for ind,s in enumerate(S[:-1]):
    if(s==S[ind+1]):
        li[-1]+=1
    else:
        li.append(1)

#%%
for ind,i in enumerate(li):
    if(ind==0):
        ans += i-1
    elif(ind<=2*K):
        ans += i
    else:
        ans += max(i-1,0)
print(ans)

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


int main() {

    ll n;
    cin >> n;
    ll min = n;
    rep(i,sqrt(n)+1) {
        if (n % i == 0) {
            ll j = n / i;
            if (i+j-2 < min) {
                min = i+j-2;
            }
        }
    }
    cout << min << endl;
}

Measured memory_bytes: 256
#include<iostream>

int main()
{
    int n, m, l, i, j, k, a[100][100], b[100][100];
    long c[100][100];

    for (i = 0; i < 100; i++) {
        for (j = 0; j < 100; j++) {
            c[i][j] = 0;
        }
    }
        
    std::cin >> n>>m>>l;


    for (i = 0; i < n; i++)
        for (j = 0; j < m; j++) {
            std::cin >> a[i][j];
        }

    for (i = 0; i < m; i++)
        for (j = 0; j < l; j++) {
            std::cin >> b[i][j];
        }

    for(i=0;i<n;i++)
        for (j = 0; j < l; j++) {
            for (k = 0; k < m; k++) {
                c[i][j] += a[i][k] * b[k][j];
            }
        }

    for (i = 0; i < n; i++) {
        for (j = 0; j < l; j++) {
            std::cout << c[i][j] ;
            if (j !=( l - 1))std::cout << " ";
        }
        std::cout << std::endl;
    }
    return 0;
}


Measured memory_bytes: 3236
#include <stdio.h>
  
  
  
int main (void) {
  int j,i,n,m,friend[501][501]={0},from,to,called[501] = {0};
  int count = 0;
    
  while(1){
    for(i = 0; i < 501;i++){
      for(j = 0; j < 501;j++){
    friend[i][j] = 0;
      }
      called[i] = 0;
    }
    count = 0;
      
    scanf("%d",&n);
      
    scanf("%d",&m);
      
    if(m == 0 && n == 0)break;
      
    for(i = 0; i < m; i++ ){
      scanf("%d %d",&from,&to);
      // printf("from: %d to: %d\n", from, to);
      friend[from][to] = 1;
      friend[to][from] = 1;
    }
  
    /*
    for(i=1; i <= n; i++)
      for(j=1; j <= n; j++)
    printf("friend[%d][%d]: %d\n", i, j, friend[i][j]);
    */
  
    called[0] = 1; called[1] = 1;
      
    for(i = 1; i <= n; i++){
      if(friend[1][i] == 1){
    if(called[i] == 0) {
      count++;
    }
    called[i] = 1;
    for(j = 1; j <= n; j++){
        
      if(friend[i][j] == 1 && called[j] == 0){
        called[j] = 1;
        count++;
      }
        
    }
      }
        
    }
  
    printf("%d\n",count);
  }
  return 0;
}

Measured memory_bytes: 1588
#include<stdio.h>
int output(int);
main(){
  int h,m,s,s1,s2,s3;
  while(1){
  scanf("%d %d %d",&h,&m,&s);
  if(h==-1&&m==-1&&s==-1)break;

  s1=(120*60)-(h*3600+m*60+s);
  s2=s1*3;
  output(s1);
  output(s2);
  }
  return 0;
}

int output(int s){
  int a,b,c,d,e,f;
  a=(s/3600)/10;
  b=(s/3600)%10;
  c=(s%3600/60)/10;
  d=(s%3600/60)%10;
  e=(s%60)/10;
  f=(s%60)%10;

  printf("%d%d:%d%d:%d%d\n",a,b,c,d,e,f);
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
#include <fstream>
#include <climits>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ

  typedef long long ll;
  typedef long double lld;
  typedef unsigned long long ull;
  int INF = INT_MAX;
  // ll mod = 1000000007;
  // lld PI = 3.141592653;
 


void solve(){
  
  int d,t,s;
  cin>>d>>t>>s;
  // lld t1 = d/s;
  if (d<=t*s){
    cout<<"Yes\n";
  }else{
    cout<<"No\n";
  }

}

  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int q = 1;
    while(q--) solve();

}

Measured memory_bytes: 3068
#include <iostream>
#include <deque>
#include <sstream>

int main() {
    std::stringstream ss;
    std::deque<int> a;
    int q;
    std::cin >> q;
    for (int i=0;i<q;++i) {
        int cmd;
        std::cin >> cmd;
        if (cmd == 0) {
            int d, x;
            std::cin >> d >> x;
            if (d == 0) a.push_front(x);
            if (d == 1) a.push_back(x);
        }
        if (cmd == 1) {
            int p;
            std::cin >> p;
            ss << a[p] << std::endl;
        }
        if (cmd == 2) {
            int d;
            std::cin >> d;
            if (d == 0) a.pop_front();
            if (d == 1) a.pop_back();
        }
    }
    std::cout << ss.str();
    return 0;
}


Measured memory_bytes: 4992
#include <stdio.h>

#define T_SIZE 100000
#define S_SIZE 50000

int binary(long T[], long find, long left, long right)
{
  long half;
  if(left > right) return -1;

  half = (right + left) / 2 ;

  if(T[half] < find){
    return binary(T, find, half + 1, right);
  }else if(find < T[half] ){
    return binary(T, find, left, half - 1);
  }else{
    return half;
  }
}

int main(void)
{
  long T[T_SIZE];
  long S[S_SIZE];
  long n, q;
  long i;
  long found;

  scanf("%10ld", &n);
  for(i = 0; i < n ; i++) scanf("%10ld", &T[i]);

  scanf("%10ld", &q);
  for(i = 0; i < q ; i++) scanf("%10ld", &S[i]);

  found = 0;

  for(i = 0; i < q; i++){
    int ret;
    ret = binary(T, S[i], 0, n);
    if(ret > 0) found++;
  }

  printf("%ld\n", found);

  return 0;
}

Measured memory_bytes: 1768
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <queue>

using namespace std;

int main(){
    long n, k, q;
    cin >> n >> k >> q;
    vector<long> scores(n, k);
    for(int i=0; i<q; i++){
        int c;
        cin >> c;
        scores[c-1]++;
    }

    for(int i=0; i<n; i++){
        scores[i] -= q;
        if(scores[i] > 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 1408
#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 all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);

int N, A, B, C;

ll dfs(int i, int a, int b, int c, vi &l) {
    if (i == N) {
        if (!a || !b || !c) return INF;
        return abs(a - A) + abs(b - B) + abs(c - C);
    }
    ll ret = dfs(i + 1, a, b, c, l);

    ret = min(ret, dfs(i + 1, a + l.at(i), b, c, l) + (a ? 10 : 0));
    ret = min(ret, dfs(i + 1, a, b + l.at(i), c, l) + (b ? 10 : 0));
    ret = min(ret, dfs(i + 1, a, b, c + l.at(i), l) + (c ? 10 : 0));

    return ret;
}

int main() {
    cin >> N >> A >> B >> C;
    vi l(N);
    rep(i, N) { cin >> l.at(i); }
    cout << dfs(0, 0, 0, 0, l) << endl;
}


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

int main (){
  char b;
  cin >> b;
  
  if ( b == 'A') b = 'T';
  else if ( b == 'T') b = 'A';
  else if ( b == 'C') b = 'G';
  else if ( b == 'G') b = 'C';
  
  cout << b << endl;
  return 0;
}

  

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

namespace ConsoleApplication30
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
                int a = ab[0];
                int b = ab[1];
                {
                    if (a == 0 && b == 0)
                        break;

                    {
                        for (int c = 1; c <= a; c++)
                        {

                            for (int d = 1; d <= b; d++)
                            {
                                if ((c + d) % 2 == 0)
                                {
                                    Console.Write("#");
                                }
                                else
                                {
                                    Console.Write(".");
                                }


                            }
                            Console.WriteLine();
                        }
                    }
                } Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 9320
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

N,A = ilint()
B = lint()
if sum(A)<sum(B):
    print(-1)
    exit()
index = list(range(N))
index.sort(reverse=True, key=lambda x:B[x]-A[x])
ans = tmp = 0
for i in index:
    if B[i]-A[i]<=0:
        break
    tmp += B[i]-A[i]
    ans += 1
for i in index[::-1]:
    if tmp==0:
        break
    tmp -= min(tmp,A[i]-B[i])
    ans += 1
print(ans)

Measured memory_bytes: 98208
#include <bits/stdc++.h>
using namespace std;
//
int main() {
	int n,i,j;
	double sum;
	cin >> n;

	for (int m = 0; m < n; m++) {
		cin >> i;
		sum += 1.0/(double)i;
	}

	sum = 1.0 / sum;

	cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    int ans = 0;
    int cnt = 0;
    rep(i,n){
        int a,b;
        cin >> a >> b;
        if(a==b)cnt++;
        else cnt = 0;
        if(cnt==3)ans = 1;
    }
    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;
#define fre freopen("in.txt","r",stdin)
#define IO ios::sync_with_stdio(false)
#define mem(a,n) memset(a,n,sizeof(a))
#define rep(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
typedef long long ll;
const int INF=0x3f3f3f3f;
const double PI=3.1415926;
const int MOD=1e9+7;
const int N=1e3+5;
int main()
{
    int n;
    scanf("%d",&n);
    bool flag=0;
    char ch;
    while(n--)
    {
        scanf(" %c",&ch);
        if(ch=='Y'&&!flag) flag=1;
    }
    printf("%s\n",flag?"Four":"Three");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    if( n%10==2 || n%10==4 || n%10==5 || n%10==7 || n%10==9 ){
        printf("hon");
    }
    if( n%10==0 || n%10==1 || n%10==6 || n%10==8 ){
        printf("pon");
    }
    if( n%10==3 ){
        printf("bon");
    }
}


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

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    int N, A, B;
    cin >> N >> A >> B;

    cout << min(N*A, B) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

const int SIDE_MAX = 6;

class DICE {
public:
	DICE(void) {};
	void ReadSide(void);
	void Roll(char dimension);
	int GetSide(int side);
private:
	int m_a_side[SIDE_MAX];
};

void DICE::ReadSide(void) {
	char tmp[2];
	for (int i = 0; i < SIDE_MAX; i++) {
		scanf("%d", &m_a_side[i]);
	}
	scanf("%c", &tmp);
	return;
}

void DICE::Roll(char dimension) {
	int* a_tmp[4 + 1];
	int tmp; a_tmp[0] = &tmp;

	switch (dimension) {
	case 'W':
		a_tmp[1] = &m_a_side[0]; a_tmp[2] = &m_a_side[2];
		a_tmp[3] = &m_a_side[5]; a_tmp[4] = &m_a_side[3];
		break;
	case 'N':
		a_tmp[1] = &m_a_side[0]; a_tmp[2] = &m_a_side[1];
		a_tmp[3] = &m_a_side[5]; a_tmp[4] = &m_a_side[4];
		break;
	case 'E':
		a_tmp[1] = &m_a_side[0]; a_tmp[2] = &m_a_side[3];
		a_tmp[3] = &m_a_side[5]; a_tmp[4] = &m_a_side[2];
		break;
	case 'S':
		a_tmp[1] = &m_a_side[0]; a_tmp[2] = &m_a_side[4];
		a_tmp[3] = &m_a_side[5]; a_tmp[4] = &m_a_side[1];
		break;
	}
	for (int i = 0; i < 4 + 1; i++) {//アドレスを入れ替える
		*a_tmp[i] = *a_tmp[(i + 1) % (1 + 4)];
	}
	return;
}

int DICE::GetSide(int side) {
	return m_a_side[side - 1];
}

int main(void) {
	char tmp[2];
	DICE dice;

	dice.ReadSide();
	while (true) {
		scanf("%c", &tmp);
		if (tmp[0] == '\n') break;
		dice.Roll(tmp[0]);
	}
	printf("%d\n", dice.GetSide(1));//一番上の目を表示
	return 0;
}


Measured memory_bytes: 2756
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

int isPrime(LL p){
	if(p<=1) return 0;
	if(p==2 || p==3 || p==5 || p==7) return 1;
	if(p==4 || p==6 || p==8 || p==9) return 0;

	LL i;
	int ret = 1;
	for(i=2; i*i<=p; i++){
		if(p%i==0 && i!=p){
			ret = 0;
			break;
		}
	}
	return ret;
}

LL GCD(LL x, LL y){
        LL r=0;

	if( x<y ) swap(x, y);
        r = x % y;
        while(r!=0){
                x = y;
                y = r;
                r = x % y;
        }
        return y;
}

void factorize(long long N, map<long long, int> &mp){
	if(N == 1){
		return;
	}
	if(isPrime(N)){
		mp[N] += 1;
		return;
	}

	long long i = 2, n = N;
	for(i = 2; n != 1 && i < (N/2) + 1; i++){
		if((n % i)==0){
			if(isPrime(i)){
				int e = 0;
				long long u = n;
				while((u % i)==0){
					e++;
					u = u / i;
					n = u;
				}
				mp[i] = e;
				if(isPrime(n)){
					mp[n] = 1;
					break;
				}
			}
		}
	}
	return;
}

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL N;
	vector<LL> A;
	cin >> N;

	for(int i=0; i<N; i++){
		LL a;
		cin >> a;
		A.push_back(a);
	}
	sort(A.begin(), A.end());

	LL d = A[0];
	for(int i=1; i<A.size(); i++){
		d = GCD(d, A[i]);
	}
	if(d != 1){
		printf("not coprime\n");
		return 0;
	}

	map<LL, int> MP;
	for(int i=0; i<A.size(); i++){
		map<LL, int> m;
		factorize(A[i], m);
		for(auto itr = m.begin(); itr != m.end(); itr++){
			LL k = itr->first;
			if(MP.count(k) == 0){
				MP[k] = 1;
			}
			else{
				printf("setwise coprime\n");
				return 0;
			}
		}
	}
	printf("pairwise coprime\n");
	return 0;
}

Measured memory_bytes: 11620
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for k in b:
    for i in a:
        for j in range(3):
            if i[j] == k:
                i[j] = 0
tf1 = sum(a[0])==0 or sum(a[1])==0 or sum(a[2])==0
tf2 = a[0][0] == a[1][0] == a[2][0] or a[0][1] == a[1][1] == a[2][1] or a[0][2] == a[1][2] == a[2][2]
tf3 = a[0][0] == a[1][1] == a[2][2] or a[0][2] == a[1][1] == a[2][0]
tf = tf1 or tf2 or tf3

print("Yes") if tf else print("No")

Measured memory_bytes: 9080
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int n,ans = 0;
VVI x(15, VI(0));
vector<vector<bool>> y(15, vector<bool>(0));
vector<bool> p(15);

void dfs(int c,int s) {
	if (c == n) {
		REP(i, n) {
			REP(j, x[i].size()) {
				if (p[i]) {
					if (p[x[i][j]] != y[i][j])
						return;
				}
			}
		}
		ans = max(ans, s);
		return;
	}
	p[c] = 0;
	dfs(c + 1, s);
	p[c] = 1;
	dfs(c + 1, s + 1);
	return;
}

int main() {
	cin >> n;
	int a,b,c;
	REP(i, n) {
		cin >> a;
		REP(j, a) {
			cin >> b >> c;
			x[i].push_back(b - 1);
			y[i].push_back(c);
		}
	}
	dfs(0,0);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
use std::io;


fn main() {
    let n = read_one::<usize>();

    let mut flg = false;
    for i in 0..26 {
        for j in 0..15 {
            if i * 4 + j * 7 == n { flg = true; }
        }
    }
    if flg { println!("Yes"); }
    else { println!("No"); }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    if (a == b && b == c) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][] map = new int[14][14];
		
		while(sc.hasNext()){
			String s = sc.next();
			int x = Integer.valueOf(s.substring(0,1)) + 2;
			int y = Integer.valueOf(s.substring(2,3)) + 2;
			int z = Integer.valueOf(s.substring(4,5));
			map[y][x]++;
			map[y][x+1]++;
			map[y][x-1]++;
			map[y+1][x]++;
			map[y-1][x]++;
			if(z==2 || z==3){
				map[y+1][x+1]++;
				map[y+1][x-1]++;
				map[y-1][x+1]++;
				map[y-1][x-1]++;
			}
			if(z==3){
				map[y+2][x]++;
				map[y][x+2]++;
				map[y-2][x]++;
				map[y][x-2]++;	
			}
		}
		int max=0;
		int count=0;
		for(int i=2;i<12;i++){
			for(int j=2;j<12;j++){
				if(map[i][j]==0)count++;
				if(map[i][j]>max)max=map[i][j];
			}
		}
		System.out.println(count);
		System.out.println(max);
		
	}
}

Measured memory_bytes: 17144
# coding: utf-8
def main():
    S = input()
    T = input()
    count = 0
    if len(S) + 1 == len(T):
        for i in range(len(S)):
            if S[i] == T[i]:
                count += 1
        if count == len(S):
            print("Yes")
            quit()
    print("No")
if __name__ == "__main__":
    main()

Measured memory_bytes: 9144
// AOJ Volume 0 Problem 0018

#include <stdio.h>

void sort(int *n)
{
	int i, j, t;
	
	for (i = 0; i < 4; i++){
		for (j = i + 1; j < 5; j++){
			if (n[i] < n[j]){
				t    = n[i];
				n[i] = n[j];
				n[j] = t;
			}
		}
	}
}

int main(void)
{
	int n[5];
	int i;
	
	for (i = 0; i < 5; i++){
		scanf("%d", &n[i]);
	}
	
	sort(n);
	
	printf("%d %d %d %d %d\n", n[0], n[1], n[2], n[3], n[4], n[5]);
	
	return (0);
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,1,1,0,-1,-1,-1};
const static int ty[] = {-1,-1,0,1,1,1,0,-1};
 
static const double EPS = 1e-8;


int num_of_notes;
int num_of_beauty;
ll force_of_repulsion;
ll sum[201001];
ll dp[2001][2001];
int notes[2001];
ll beauty[100001];

ll compute(int i,int j){
  ll lhs = sum[notes[i]];
  ll rhs = (notes[j] - 1 < 0 ? 0 : sum[notes[j] - 1]);

  return (lhs - rhs) / force_of_repulsion;
}

int main(){
  while(~scanf("%d %d %lld",
               &num_of_notes,
               &num_of_beauty,
               &force_of_repulsion)){

    for(int note_idx = 0; note_idx < num_of_notes; note_idx++){
      scanf("%d",notes + note_idx);
      notes[note_idx]--;
    }

    memset(sum,0,sizeof(sum));

    for(int beauty_idx = 0; beauty_idx < num_of_beauty; beauty_idx++){
      scanf("%d",beauty + beauty_idx);
      sum[beauty_idx] = (beauty_idx - 1 >= 0 ? sum[beauty_idx - 1] : 0) + beauty[beauty_idx];
    }

    sort(notes,notes + num_of_notes);
    reverse(notes,notes + num_of_notes);

    memset(dp,0x3f,sizeof(dp));

    dp[0][0] = 0;
    for(int i=0;i<num_of_notes;i++){
      int next = i + 1;
      for(int j=0;j<=i;j++){
        dp[next][j]
          = min(dp[next][j],dp[i][j] + compute(i,next));

        dp[next][i]
          = min(dp[next][i],dp[i][j] + compute(j,next));
      }
    }

    ll res = LINF;
    for(int i=0;i<num_of_notes;i++){
      res = min(dp[num_of_notes - 1][i] + compute(i,num_of_notes - 1),res);
    }
    
    printf("%lld\n",res);
  }
}

Measured memory_bytes: 34848
def main():
    N = int(input())
    A = list(map(int,input().split()))
    i = 0
    while i < N:
        if A[i] % 2 == 0:
            if (A[i] % 3) != 0 and (A[i] % 5) != 0:
                return("DENIED")
                break
        i += 1
    return("APPROVED")
print(main())

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

int main() {
	int n,x;
	cin >> n >> x;
	int cnt=1,z = 0;
	for(int i = 0;i<n;i++)
	{
		int l;
		cin >> l;
		z += l;
		if(z <= x)
		{
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n],b,ans=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		for(b=0;a[i]%2==0;b++) a[i]/=2;
		ans+=b;
	}
	cout<<ans;
	return 0;
}


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

typedef  long long ll ;

using namespace std;

int tox[]={0,0,1,-1};
int toy[]={1,-1,0,0};
int num[int(1e5+4)],red[int(1e5+4)];
int main()
{
    int n,m;
    cin>>n>>m;
    red[0]=1;
    while(m--){
        int i,x;
        cin>>i>>x;
        i--,x--;
        if(red[i])
            red[x]=1;
        num[i]--;
        num[x]++;
        if(num[i]==-1)
            red[i]=0;
    }
    int res=0;
    for (int i = 0; i < n; ++i)
    {
        res+=red[i];
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 4348
// https://atcoder.jp/contests/tenka1-2018-beginner/tasks/tenka1_2018_c
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    sort(ALL(v));
    vector<ll> sum(2, 0);
    ll before = 0;
    REP(i, 2) {
        if (i == 1) {
            reverse(ALL(v));
        }
        deque<int> q, t;
        REP(i, n) q.push_back(v[i]);

        t.push_back(q.front());
        q.pop_front();
        REP(i, n - 1) {
            if (i % 4 <= 1) {
                if (i % 4 == 0) {
                    t.push_front(q.back());
                } else {
                    t.push_back(q.back());
                }
                q.pop_back();
            } else {
                if (i % 4 == 2) {
                    t.push_front(q.front());
                } else {
                    t.push_back(q.front());
                }
                q.pop_front();
            }
        }
        bool first = true;
        for (auto x : t) {
            if (first) {
                first = false;
            } else {
                sum[i] += abs(x - before);
            }
            before = x;
        }
    }

    cout << max(sum[0], sum[1]) << endl;

    return 0;
}


Measured memory_bytes: 1152
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const int M=3*1000*100+10;
char in[M];
int group[20][M];
int order[20][M];
int pos[M];
int head[M];
int common[M];
vector<int> qr[M];
int len,m;
int main() {
	scanf("%d%d",&len,&m);
	scanf("%s",in);
	fill(head,head+256,0);
	for(int i=0;i<len;i++){
		int v=in[i];
		head[v+1]++;
	}
	for(int i=1;i<256;i++){
		head[i]+=head[i-1];
	}
	for(int i=0;i<len;i++){
		int v=in[i];
		order[0][head[v]++]=i;
		group[0][i]=v;
	}
	fill(head,head+256,0);
	int e=1;
	for(;(1<<e)<=len;e++){
		int w=1<<(e-1);
		fill(head,head+len+1,0);
		int vmax=-1;
		// set head
		for(int i=0;i<len;i++){
			int v=group[e-1][i];
			head[v+1]++;
			vmax=max(vmax,v);
		}
		for(int i=1;i<=vmax;i++){
			head[i]+=head[i-1];
		}
		// sort
		for(int i=0;i<len;i++){
			int a=order[e-1][i];
			if(len<=a+w){
				int v=group[e-1][a];
				order[e][head[v]++]=a;
			}
		}
		for(int i=0;i<len;i++){
			int a=order[e-1][i];
			if(0<=a-w){
				int v=group[e-1][a-w];
				order[e][head[v]++]=a-w;
			}
		}
		// set group
		int p0=-2,p1=-2;
		int g=-1;
		for(int i=0;i<len;i++){
			int a=order[e][i];
			int n0=group[e-1][a];
			int n1=-1;
			if(a+w<len){
				n1=group[e-1][a+w];
			}
			if(p0!=n0||p1!=n1){
				p0=n0;
				p1=n1;
				g++;
			}
			group[e][a]=g;
#if 0
			cout << group[e][a] << " ";
			for(int b=a;b<len;b++){
				cout << in[b];
			}
			cout << endl;
#endif
		}
	}

	// common
	for(int i=1;i<len;i++){
		int pre=order[e-1][i-1];
		int a=order[e-1][i];
		int sum=0;
		int r0=pre;
		int s0=a;
		while(1)
		{
			int r=r0+sum;
			int s=s0+sum;
			int l=0;
			while(r+(1<<l)<=len&&s+(1<<l)<=len&&group[l][r]==group[l][s]){
				l++;
			}
			if(l==0)break;
			sum+=(1<<(l-1));
		}
		common[i]=sum;
		//cout << i << ", " << sum << endl;
	}

	for(int i=0;i<len;i++){
		// e>0ならgroup と一緒のはず
		pos[order[e-1][i]]=i;
	}
	int left=0,right=0;
	for(int i=0;i<m;i++){
		char q[4];
		scanf("%s",q);
		if(q[0]=='R'){
			if(q[1]=='+'){
				right++;
			}
			else
			{
				right--;
			}
		}
		else
		{
			if(q[1]=='+'){
				left++;
			}
			else
			{
				left--;
			}
		}
		//cout << "qr " << order[e-1][left] << ", " << right-left+1 << endl;
		qr[pos[left]].push_back(right-left+1);
	}
	priority_queue<int> pq;
	int ret=0;
	for(int i=len-1;i>=0;i--){
		for(auto it:qr[i]){
			pq.push(it);
			//cout << "push " << i << ": " << it << endl;
		}
		int pre=-1;
		while(pq.size()&&pq.top()>common[i]){
			if(pq.top()!=pre){
				pre=pq.top();
				ret++;
			}
			//cout << "pop " << i << ": " << pq.top() << endl;
			pq.pop();
		}
	}
	printf("%d\n",ret);
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int ans=0;
  for(int i=0;i<n;i++){
    while(a[i]%2==0){
      a[i]/=2;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int x, y, z;
    cin >> x >> y >> z;
    int ans = 1;
    x -= y + 2 * z;
    while(x >= y + z){
        ans++;
        x -= y + z;
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int k;cin>>k;
  int a,b;cin>>a>>b;

  bool f=false;
  if(a%k==0)f=true;
  rep1(i, b-a){
    if((a+i)%k==0)f=true;
  }

  if(f)cout<<"OK"<<endl;
  else cout<<"NG"<<endl;

  return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

// 1: white, 2: black, 3: removed
vector<vector<int>> board;

int main(void) {
    int H, W;
    cin >> H >> W;

    board.resize(H, vector<int>(W));
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            char a;
            cin >> a;
            if (a == '#') {
                board[h][w] = 2;
            } else {
                board[h][w] = 1;
            }
        }
    }

    for (int h = 0; h < H; h++) {
        bool should_remove = true;
        for (int w = 0; w < W; w++) {
            if (board[h][w] == 2) {
                should_remove = false;
            }
        }
        if (should_remove) {
            for (int w = 0; w < W; w++) {
                board[h][w] = 3;
            }
        }
    }

    for (int w = 0; w < W; w++) {
        bool should_remove = true;
        for (int h = 0; h < H; h++) {
            if (board[h][w] == 2) {
                should_remove = false;
            }
        }
        if (should_remove) {
            for (int h = 0; h < H; h++) {
                board[h][w] = 3;
            }
        }
    }

    for (int h = 0; h < H; h++) {
        bool emitted = false;
        for (int w = 0; w < W; w++) {
            if (board[h][w] == 1) {
                emitted = true;
                cout << '.';
            } else if (board[h][w] == 2) {
                emitted = true;
                cout << '#';
            }
        }
        if (emitted) {
            cout << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
// Last Change: 07/01/2019 22:54:50.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

/* Cost
 * insert : I
 * erase  : E
 * replace: R
 */
ll I, E, R;

ll LevenshteinDistance(string str1, string str2) {
  const ll lenStr1 = str1.size(), lenStr2 = str2.size();

  vector<vector<ll>> dist(lenStr1 + 1, vector<ll>(lenStr2 + 1, 0));
  for (ll i = 0; i < lenStr1 + 1; ++i) {
    dist[i][0] = i;
  }
  for (ll i = 0; i < lenStr2 + 1; ++i) {
    dist[0][i] = i;
  }

  for (ll i = 1; i < lenStr1 + 1; ++i) {
    for (ll j = 1; j < lenStr2 + 1; ++j) {
      const ll cost = (str1[i - 1] == str2[j - 1]) ? 0 : R;
      dist[i][j] = min(dist[i - 1][j] + I,
                       min(dist[i][j - 1] + E, dist[i - 1][j - 1] + cost));
    }
  }

  return dist[lenStr1][lenStr2];
}

int main() {
  string str1, str2;

  cin >> str1 >> str2;
  // cin>>I>>E>>R;
  I = E = R = 1;

  cout << LevenshteinDistance(str1, str2) << endl;
}



Measured memory_bytes: 10856
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

int N,ans;
bool* state;

struct Info{
	Info(){
		x = y = r = 0.0;
		color = 0;
	}
	double x,y,r;
	int color;
};


bool isOverlap(Info left,Info right){
	double dist = sqrt((left.x-right.x)*(left.x-right.x)+(left.y-right.y)*(left.y-right.y));
	return dist <  left.r + right.r;
}


int makeCode(bool removed[]){

	int ret = 0;

	int S = 1;
	for(int i = 0; i <= N-1; i++){
		if(removed[i]){
			ret += S;
		}
		S *= 2;
	}
	return ret;
}


void recursive(Info info[],bool removed[],int count){

	if(ans == N)return;

	ans = max(ans,count);

	bool check[N],over_rapFLG;

	for(int i = 0; i < N; i++)check[i] = false;

	for(int i = N-1; i >= 0; i--){

		if(removed[i] == true)continue;

		over_rapFLG = false;

		for(int j = i-1; j >=0; j--){

			if(removed[j] == true)continue;

			if(isOverlap(info[i],info[j])){
				over_rapFLG = true;
				break;
			}
		}
		if(!over_rapFLG){
			check[i] = true;
		}
	}

	for(int i = 0; i < N-1; i++){
		for(int k = i+1; k < N; k++){
			if(check[i] == true && check[k] == true && info[i].color == info[k].color){
				if(count == N-2){
					ans = N;
					return;
				}

				bool next_removed[N];
				for(int i = 0; i < N; i++)next_removed[i] = removed[i];
				next_removed[i] = true;
				next_removed[k] = true;

				int code = makeCode(next_removed);

				if(state[code] == false){
					state[code] = true;
					recursive(info,next_removed,count+2);
				}
			}
		}
	}
}

void func(){
	Info info[N];

	int limit = pow(2,N);

	for(int i = 0; i < limit; i++)state[i] = false;

	for(int i = 0; i < N; i++){
		scanf("%lf %lf %lf %d",&info[i].x,&info[i].y,&info[i].r,&info[i].color);
	}

	ans = 0;

	bool removed[N];
	for(int i = 0; i < N; i++)removed[i] = false;

	recursive(info,removed,0);

	printf("%d\n",ans);
}

int main(){

	state = new bool[16777216];

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 19320
#include<bits/stdc++.h>
using namespace std;
constexpr int mod = 1e9 +7;
constexpr int MAXNe6 = 1e6 + 7;
#pragma region 
inline long long read()
{
	char c = getchar();long long flag = 1, ans = 0;
	while(c < '0' || c > '9'){if(c == '-')flag = -1; c = getchar();}
	while(c >= '0' && c <= '9'){ans = ans * 10 + c - '0'; c = getchar();}
	return (ans * flag);
}
#pragma endregion
// C'est la vie
int main() {
    long long n = read(), k = read();
    vector<int> nums;
    for(int i = 0; i < n; ++ i) {
        int input = read();
        nums.emplace_back(input);
    }
    // cout << nums.size() << endl;
    // for_each(nums.begin(), nums.end(), [](const int &i) -> void{cout << i << " ";});
    // cout << endl;
    sort(nums.begin(), nums.end());
    long long ans = 0;
    for(int i = 0; i < n - k; ++ i) {
        ans += nums[i];
    }
    cout << ans << endl;
    #ifndef ONLINE_JUDGE
    system("pause");
    #endif
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
using Graph = vector<vector<int>>;
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;

int main (){
  int N;
  cin>>N;
  vector<int>NAA(20000,0);
  for(int i=1;i<=100;i++){
    for(int j=1;j<=100;j++){
      for(int k=1;k<=100;k++){
        if(i*i+j*j+k*k+i*j+i*k+k*j<=20000){
          NAA[i*i+j*j+k*k+i*j+i*k+k*j]++;
        }
      }
    }
  }
  rep(i,N){
    cout<<NAA[i+1]<<endl;
  }
}


Measured memory_bytes: 3676
N = int(input() )
a = []
num = 0
for i in range(1,N+1):
    if i%15==0 :
        a.append('FizzBuzz')
    elif i%3==0 :
        a.append('Fizz')
    elif i%5==0 :
        a.append('Buzz')
    else:
        a.append(i)
        num += i

print(num)

Measured memory_bytes: 33780
n = int(input())
A = [-1]
for _ in range(n):
    A.append(int(input()))

num = 0
count = 0
if A[1] != 0:
    print(-1)
else:
    for i in range(n,0,-1):
        if A[i] > num:
            num = A[i]
            count += num
        elif A[i] < num:
            print(-1)
            break
        num -= 1
    else:
        print(count)
    

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

const int MAX_N = 2e5 + 5;
int n, q, ans;
int Arr[MAX_N];
int cnt[MAX_N];
int val[MAX_N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> q;
	for (int i = 0; i < n; i++) {
		cin >> Arr[i];
		cnt[Arr[i]]++;
	}

	for (int i = 1; i <= n; i++)
		for (int j = max(0, i - cnt[i]); j < i; j++)
			val[j]++;

	for (int i = 0; i < n; i++)
		ans += !val[i];

	while (q--) {
		int x, y;
		cin >> x >> y;
		x--;

		if (0 <= Arr[x] - cnt[Arr[x]]) {
			if (val[Arr[x] - cnt[Arr[x]]] == 1)
				ans++;

			val[Arr[x] - cnt[Arr[x]]]--;
		}

		cnt[Arr[x]]--;

		Arr[x] = y;
		cnt[Arr[x]]++;
		if (0 <= Arr[x] - cnt[Arr[x]]) {
			if (val[Arr[x] - cnt[Arr[x]]] == 0)
				ans--;
			
			val[Arr[x] - cnt[Arr[x]]]++;
		}

		cout << ans << "\n";
	}
	return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;

struct UnionFind{

        std::vector<int> data;
        // dataの各要素について
        // 負の値:その集合のルートであること示す。また、その絶対値は集合の要素数となっている。
        // 正の値:親ノードの番号(dataのインデックス)。root()を呼び出すたびに集合のルートを指すように書きなおされるので木はそんなに深くならない

        //初期化 size:最大要素数
        UnionFind(int size): data(size, -1) {}

        // 集合を併合する
        // すでに同じ集合だった場合は、falseが返る
        bool unite(int x, int y){
                x=root(x);
                y=root(y);
                if( x != y ){
                        // 要素数の大きな方へ合併するためのswap
                        if( data[y] < data[x] ) std::swap(x, y);
                        // 要素数を加算する
                        data[x] += data[y];
                        // yの属する集合のルートをxに変更
                        data[y] = x;
                }
                return x!=y;
        }

        // 同じ集合かどうか判定
        bool find(int x, int y){
                return root(x) == root(y);
        }

        // 集合の識別番号を返す
        int root(int x){
                // 負の値を持つものがその集合のルート
                // 正の値は同じ集合に属するものを指す(辿ればいずれルートへ着く)
                return (data[x] < 0)? x : data[x]=root(data[x]);
        }

        // 集合の要素数を返す
        int size(int x){
                return -data[ root(x) ];
        }
};


int main(){
        ios_base::sync_with_stdio(false);
        ll H, W, ans=0;
        string S[505];

        cin >> H >> W;
        rep(i,H) cin >> S[i];

        UnionFind uf(H*W);
        rep(i,H) rep(j,W){
                if( j+1 < W && S[i][j] != S[i][j+1] ) uf.unite(i*W + j, i*W + (j+1));
                if( i+1 < H && S[i][j] != S[i+1][j] ) uf.unite(i*W + j, (i+1)*W + j);
        }

        ll count[2][300005] = {};
        rep(i,H) rep(j,W){
                int id = uf.root(i*W + j);
                int sg = S[i][j] == '#';
                count[sg][id]++;
        }

        //rep(i, H*W) cout << i << " " << count[0][i]  << " "<< count[1][i] << endl;

        rep(i, H*W) ans += count[0][i] * count[1][i];

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <cstdlib>
#include <math.h>

using namespace std;

int main()
{
    int n, d, ans;
    ans = 0;
    cin >> n >> d;

    ans = n / (d * 2 + 1);
    if (n % (d*2+1)!=0) {
        ans++;
    }
    

    cout << ans;
}

Measured memory_bytes: 256
def find(x):
  if x == parent[x]:
    return x
  x = parent[x]
  return find(x)

def Union(x, y):
  a = find(x)
  b = find(y)
  if a != b:
    if NumTable[a] > NumTable[b]:
      parent[b] = a
      NumTable[a] += NumTable[b]
    else:
      parent[a] = b
      NumTable[b] += NumTable[a]

N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for i in range(M)]
AB.reverse()

#各ノードの親を示す
parent = [i for i in range(N + 1)]
#各ノードが属する素集合の大きさを示す
NumTable = [1 for i in range(N + 1)]

#答えを格納するlist，最後に逆順で出力
L = []
#橋が何もかかっていない時の不便さ
Ans = N * (N - 1) // 2
for i in AB:
  L.append(Ans)
  a = find(i[0])
  b = find(i[1])
  if a != b:
    ta = NumTable[a]
    tb = NumTable[b]
    Union(a, b)
    Ans -= (ta + tb) * (ta + tb - 1) // 2  - ta * (ta - 1) // 2 - tb * (tb - 1) // 2
    Union(a, b)

for i in L[::-1]:
  print(i)


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

int main() {
int N;
cin >> N;
int X;
X = N%10;
if(X == 2 || X == 4 || X == 5 || X == 7 || X == 9){
cout << "hon" << endl;}
if(X == 0 || X == 1 || X == 6 || X == 8){
cout << "pon" << endl;}
if(X == 3){
cout << "bon" << endl;}}


Measured memory_bytes: 3632
// C++ 14
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>

#define ll long long
#define Int int
#define loop(x, start, end) for(Int x = start; x < end; x++)
#define loopdown(x, start, end) for(int x = start; x > end; x--)
#define span(a,x,y) a.begin()+x,a.begin()+y
#define span_all(a) a.begin(),a.end()
#define len(x) (x.size())
#define last(x) (*(x.end()-1))

using namespace std;

#define MAX_N 100001

Int N;
char S[MAX_N];

Int solve() {
  Int count = 1;
  loop(n,1,N) {
    if (S[n] != S[n-1]) count++;
  }
  return count;
}

int main() {
  cin >> N;
  loop(n,0,N) cin >> S[n];
  cout << solve() << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll x;
  cin >> x;
  cout << !x << endl;

  return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		String m = in.nextLine();
		boolean n = false, w = false, s = false, e = false;
		for(int i = 0; i < m.length(); i++){
			switch(m.charAt(i)){
			case 'N': n = true; break;
			case 'W': w = true; break;
			case 'S': s = true; break;
			case 'E': e = true; break;
			}
		}
		if(n && w && s && e || n && s && !w && !e || !n && !s && w && e){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if(A >= B && C >= D){
    cout << B + D << endl;
  }
  
  else if(A > B && C < D){
  cout << B + C << endl;}
   else if(A < B && C > D){
     cout << A + D << endl;}
  else{cout << A+C << endl;}
}

Measured memory_bytes: 256