akhauriyash/Code-Regression huggingface dataset:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt, pi
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N = getN()
# Rはループさせるのでソートさせる必要ない
R = [getList() for i in range(N)]
R_l = [1] * N

B = [getList() for i in range(N)]
B.sort()

# 貪欲法でペア作りする問題
# ABC005 C - おいしいたこ焼きの売り方の時と同様に
# それとしか繋げないもの　を優先的に繋いでいく

# 条件Aの通過が厳しい順に対象bをソートし、
# たこ焼き　条件A:客が来る前にたこ焼きができてないといけない
#  　　　　      客を来るのが早い順に並べる（最初から並んでる）
# 今回     条件A:赤星のx座標が青星のx座標より小さくないといけない
#  　　　　　　　 青星をx座標が小さい順に並べる

# 条件A, 条件Bをクリアしたものの中で、最も条件Bの通過が厳しい対象aと結ぶ
# たこ焼き　条件B:たこ焼きが賞味期限より前のものでないといけない
#  　　　　      できるだけ古いものを売る（最初から並んでる）
# 今回     条件B:赤星のy座標が青星のy座標より小さくないといけない
#  　　　　　　　 条件をクリアしたもののうちでできるだけy座標が大きいものを選ぶ

ans = 0
for b in B:
    max_y = -1
    max_index = -1
    for i, a in enumerate(R):
        # x, y座標が小さいもののうちでまた使ってないもの
        if a[0] < b[0] and a[1] < b[1] and R_l[i] == 1:
            # あるならY座標が最も大きいもの
            if a[1] > max_y:
                max_y = a[1]
                max_index = i
    if max_y >= 0:
        R_l[max_index] = 0
        ans += 1
print(ans)

Measured memory_bytes: 83912
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		if((B/A) > C) {
			System.out.println(C);
		}else {
			System.out.println(B/A);
		}

	}

}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int a[1214];
main(){
    int n;
    cin >> n;

    for(int i = 1; i <= n + 1; i+=n){
        cout << "? ";
        for(int j = i; j < i + n; j++)
            cout<<j<<" ";
        cout<<endl;
        string x;
        cin >> x;
        if(x[0] == 'R') a[i] = 1;
        else a[i] = 0;
    }
    int lo = 1, hi = n + 1;
    while(lo + 1 < hi){
        int i = (lo + hi) / 2;
        cout << "? ";
        for(int j = i; j < i + n; j++)
            cout<<j<<" ";
        cout<<endl;
        string x;
        cin >> x;
        if(x[0] == 'R') a[i] = 1;
        else a[i] = 0;
        if(a[i] == a[1]) lo = i;
        else hi = i;
    }
    int i = lo;
            vector<int> A,B;
            for(int j = 1; j <=  2*n; j++)
                if(j > i && j < i +n) A.push_back(j);
                else if(j < i || j > i + n) B.push_back(j);
            string ans = "";
            for(int j = 1; j <= 2*n; j++){
                cout<<"? ";
                if(j >= i + 1 && j < i + n)
                    for(int x : B) cout<<x<<" ";
                else for(int x : A) cout<<x<<" ";
                cout<<j<<endl;
                string s;
                cin >>s;
                ans+=s[0];

            }
            cout<<"! "<<ans<<endl;
}


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

using namespace std;

const long long MOD = 1e9 + 7;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> iii;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef priority_queue<pii, vector<pii>, greater<pii>> fila_prioridade;
typedef priority_queue<iii, vector<iii>, greater<iii>> fila_prioridade_grids;

#define nl '\n'
#define INF 1000000000
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define NeedForSpeed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

int n,m,c;

int B[25];
int A[25];

int main() {
        NeedForSpeed
	
	cin >> n >> m >> c;

	ll resultado = 0;
	ll resp = 0;


	for (int i = 0; i < m; i++) {
		cin >> B[i];
	}

	for (int i = 0; i < n; i++) {
		resultado = 0;
		for (int j  = 0; j < m; j++) {
			cin >> A[j];
			resultado += B[j] * A[j];
		}

		if (resultado + c > 0) {
			resp++;
		}
	}

	cout << resp << nl;

        return 0;
}



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

int main(){
  int N;
  scanf("%d",&N);
  if(N==1)
    printf("Hello World\n");
  else{
    int A,B;
    scanf("%d\n%d",&A,&B);
    printf("%d\n",A+B);
  }
  return 0;
}

Measured memory_bytes: 1692
from math import factorial
def comb (x,y):
	return factorial(x)//factorial(x-y)//factorial(y)

w,h,ax,ay,bx,by=map(int,input().split())
dx=min(w-abs(ax-bx),abs(ax-bx))
dy=min(h-abs(ay-by),abs(ay-by))
ans=1
if dx*2==w:ans*=2
if dy*2==h:ans*=2
ans*=comb(dx+dy,dx)
print(ans%100000007)

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

using namespace std;

#define foorp(i , a , n) for (int (i) = (a); (i) < (n); (i)++)
#define foorm(i , a , n) for (int (i) = (a); (i) > (n); (i)--)
#define ll long long int

int a , b;

int main()
{
    cin >> a >> b;
    if (a < 0 && b > 0)
        cout << "Zero" << endl;
    else if (a > 0 && b > 0)
        cout << "Positive" << endl;
    else
    {
        if ((b - a + 1) % 2 == 0)
            cout << "Positive" << endl;
        else
            cout << "Negative" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()
#define allg(v) v.begin(), v.end(), greater<int>()

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  int n;
  cin >> n;
  
  rep(i, 0, n) {
    cin >> s;
    if(s=="Y") {
      cout << "Four" << "\n";
      return 0;
    }
  }
  
  cout << "Three" << "\n";

}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int n, k;
    cin >> n >> k;
    set<int> st;
    REP(i, k)
    {
        int tmp;
        cin >> tmp;
        st.insert(tmp);
    }
    while (n)
    {
        int tmp = n;
        bool flag = true;
        while (tmp > 0)
        {
            int a;
            a = tmp % 10;
            tmp /= 10;
            if (st.find(a) != st.end())
            {
                flag = false;
            }
        }
        if (flag)
        {
            cout << n << endl;
            return 0;
        }
        n++;
    }
}

Measured memory_bytes: 256
var main = function(input) {
  input = input.split('\n');
  var N = input.shift();
  var S = input.join();
  var L;//left
  var R;//right
  var LC;
  var RC;
  var count;
  var max = 0;
  for(var i=1;i<=N;i++){//cut
    
 L = S.slice(0,i);
 R = S.slice(i,N);
 count = 0;
    	for(var j=0;j<L.length;j++){//
          for(var k=0;k<R.length;k++){//
       		LC = L.slice(0+j,1+j);
            RC = R.slice(0+k,1+k);
    		if(LC === RC){
              count++;
              R = R.split(RC).join('');
              break;
            }
          }
        }
    if(max<count){
      max = count;
    }
  } 
  console.log(max);
    return 0; 
}

main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

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

int S[100];
int top = 0;

void push(int x) {
    S[++top] = x;
}

int pop() {
    return S[top--];
}

int main() {
    int a, b;
    char s[10];

    while (scanf("%s", s) != EOF) {
        if (s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);

        } else if (s[0] == '-') {
            a = pop();
            b = pop();
            push(b - a);

        } else if (s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);

        } else {
            push(atoi(s));
        }
    }

    printf("%d\n", pop());

    return 0;
}



Measured memory_bytes: 2100
/*
   Aizu Vol-1 0147: Fukushimaken
   2017.8.15 bal4u@uu
   ?????\?????§????????????????????????
*/
#include <stdio.h>

#define MAX 100
typedef struct { int id, n, t; } QUE; QUE Q[MAX + 5]; int top, end;
#define S 17
typedef struct { int id, t; } SEAT; SEAT st[S + 10];
int ans[MAX + 5], id;

int main()
{
	int n, t, i, j, k, f;

	id = 0, top = end = 0;
	for (i = 0; i < S; i++) st[i].id = -1;
	for (t = 0; !ans[99]; t++) {
		// ??°???????????°???
		if (t % 5 == 0 && id <= 99) {
			Q[end].n = (id % 5 == 1) ? 5 : 2, Q[end].t = t, Q[end++].id = id++;
		}
		// ?£??????????????¢????
		for (i = 0; i < S; i++) {
			if (st[i].t == 0) continue;
			if (--st[i].t == 0) st[i].id = -1;
		}
		// ?????????????????????
		f = (top < end);
		while (f) {
			i = Q[top].id, n = Q[top].n, f = 0;
			for (j = 0; j < S; j++) {
				for (k = 0; k < n; k++)	if (st[j + k].id >= 0) break;
				if (k < n) continue;
				ans[i] = t - Q[top].t, top++, f = (top < end);
				for (k = 0; k < n; k++) {
					st[j + k].id = i;
					st[j + k].t = 17 * (i % 2) + 3 * (i % 3) + 19;
				}
				break;
			}
		}
	}
	while (scanf("%d", &n) == 1) printf("%d\n", ans[n]);
	return 0;
}

Measured memory_bytes: 596
#include <string>
#include <set>
#include <iostream>
using namespace std;
int main() 
{
	int n;
	string cmd;
	set<string> dic;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>cmd;
		if(cmd=="insert")
		{
			string temp;
			cin>>temp;
			dic.insert(temp);
		}
		else if(cmd=="find")
		{
			string temp;
			cin>>temp;
			if(dic.count(temp)==0)
				cout<<"no"<<endl;
			else
				cout<<"yes"<<endl;
		}
	}
}

Measured memory_bytes: 32128
import numpy as np
from scipy import ndimage

h, w = map(int, input().split())
map = [input() for _ in range(h)]
mapB = np.zeros((h, w))
for i, ii in enumerate(map):
  for j, jj in enumerate(ii):
    if jj == '.':
      mapB[i, j] = 1
dist = ndimage.distance_transform_cdt(mapB, metric="taxicab")
print(dist.max())

Measured memory_bytes: 39120
from collections import defaultdict
from itertools import count


def prime_factors(n):
  counter = defaultdict(int)  
  for i in count(2):
    if i * i > n:
      break
    while n % i == 0:
      n //= i
      counter[i] += 1
  if n != 1:
    counter[n] = 1
  return counter


A, B = map(int, input().split())

a = prime_factors(A)
b = prime_factors(B)

print(len({k for k in a} & {k for k in b}) + 1)


Measured memory_bytes: 40044
#include <bits/stdc++.h>
using namespace std;
int main(void){
    char X, Y =' ';
    map<char, int>dic;
    dic['A'] = 10;
    dic['B'] = 11;
    dic['C'] = 12;
    dic['D'] = 13;
    dic['E'] = 14;
    dic['F'] = 15;
    
    cin >> X >> Y;
    if (dic.at(X) < dic.at(Y)){ //dic.at(キー) 値の取得
        cout << '<';
    }else if (dic.at(X) > dic.at(Y)){
        cout << '>';
    }else if(dic.at(X)==dic.at(Y)){
        cout << '=';
    }
  
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

class BIT//1-index
{
public:
    vector<int> bit;
    int M;

    BIT(int M):
        bit(vector<int>(M+1, 0)), M(M) {}

    int sum(int i) {//1~iまでの和
        if (!i) return 0;
        return bit[i] + sum(i-(i&-i));
    }

    void add(int i, int x) {//bit[i]にxを足す更新
        if (i > M) return;
        bit[i] += x;
        add(i+(i&-i), x);
    }
};


int main(){
	 //cin.tie(0);
	//ios::sync_with_stdio(false);
	//std::cout << std::fixed;
	//std::cout << std::setprecision(12);
	//std::cout << std::defaultfloat;
	int n,k;
	cin>>n>>k;
	BIT b(n+2);
	vector<int> p(n);
	vector<int> p2(n);
	vector<int> pf(n);
	FOR(i,0,n){
		cin>>p[i];
		p[i]++;
		p2[i]=p[i];
	}
	sort(p2.begin(),p2.end());
	int t=1;
	FOR(i,0,n){
		if(p[i]-1!=i){
			t=0;
		}
	}
	if(n==k||t){
		cout<<1<<endl;
		return 0;
	}
	int f=1;
	FOR(i,0,k){
		if(p[i]!=p2[i]){
			f=0;
		}
	}
	int ans=1;
	int cnt=1,mn=p[0],mx=p[0];
	b.add(p[0],1);
	FOR(i,1,k){
		if(p[i]>p[i-1]){
			cnt++;
		}else{
			cnt=1;
		}
		b.add(p[i],1);
		mn=min(mn,p[i]);
		mx=max(mx,p[i]);
	}
	//cout<<k-1<<" "<<ans<<endl;
	FOR(i,k,n){
		//cerr<<"********  i:"<<i<<endl;
		int sc=1;
		if(p[i]>p[i-1]){
			cnt++;
		}else{
			cnt=1;
		}
		if(cnt>=k){
			if(f==0){
				f=1;
			}else{
				sc=0;
			}
		}
		if(p[i-k]==mn&&p[i]>=mx){

		}else{
			ans+=sc;
		}
		b.add(p[i-k],-1);
		//cerr<<p[i-k]<<" ";
		//cerr<<"b.sum(p[i-k]):"<<b.sum(p[i-k])<<endl;
		if(b.sum(p[i-k])==0){
			int r=mx;
			int l=p[i-k];
			int m=(l+r)/2;
			while(l!=m){
				if(b.sum(m)==0){
					l=m;
				}else{
					r=m;
				}
				m=(l+r)/2;
			}
			mn=m+1;
		}
		if(b.sum(p[i-k])==k-1){
			int r=mx;
			int l=mn;
			int m=(l+r+1)/2;
			while(l!=m){
				if(b.sum(m)==k-1){
					r=m;
				}else{
					l=m;
				}
				m=(l+r)/2;
			}
			mx=m-1;
		}
		//cerr<<b.sum(p[i])<<endl;
		if(b.sum(p[i])==0){
			mn=p[i];
		}
		if(b.sum(p[i])==k-1){
			mx=p[i];
		}
		b.add(p[i],1);

		//cerr<<i<<" ans:"<<ans<<" mn:"<<mn<<" mx:"<<mx<<endl;

	}

	cout<<ans<<endl;



	return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>

int main() {
	int n, k;
	int INF = 1001001001;
	cin >> n >> k;
	int score[3];
	rep(i, 3) {
		cin >> score[i];
	}
	string a;
	cin >> a;
	int nn = n / k+1;
	vector<string>b(k);
	vector<vector<int>>c(k,vector<int>(nn));
	rep(i, n) {
		b[i % k] += a[i];
	}
	int sum(0);
	rep(i, k) {
		int buffer;
		rep(j, nn) {
			if (b[i][j] == 'r')c[i][j] = score[2];
			if (b[i][j] == 's')c[i][j] = score[0];
			if (b[i][j] == 'p')c[i][j] = score[1];
			buffer = c[i][j];
			//cout << c[i][j] << endl;
			//cout << i<<' '<<j<<' '<<buffer << endl;
			if (j ==0) {
				sum += buffer;
			}else if (b[i][j]!=b[i][j-1]) {
				sum += buffer;
			}
			else {
				b[i][j]='x';
			}
		}
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 9984
#include <cstdio>
#include <algorithm>
int N, __K__, head[100001], next[199999], to[199999], E, q[100001], fa[100001];
int p[100001], w[100001], g[100001], L[100001], R[100001];
int main()
{
	scanf("%d", &N);
	for (int i = 1, u, v; i < N; i++)
	{
		scanf("%d%d", &u, &v);
		next[++E] = head[u], to[E] = v, head[u] = E;
		next[++E] = head[v], to[E] = u, head[v] = E;
	}
	for (scanf("%d", &__K__); __K__--; )
	{
		int x, y;
		scanf("%d%d", &x, &y);
		p[x] = 1;
		w[x] = y;
	}
	int H = 0, T = 1, u;
	q[1] = 1;
	while (H < T)
		for (int e = head[u = q[++H]]; e; e = next[e])
			if (to[e] != fa[u])
				fa[q[++T] = to[e]] = u;
	for (int i = N; i; i--)
	{
		int u = q[i];
		int appear_0 = 0, L_0 = -1000000000, R_0 = 1000000000;
		int appear_1 = 0, L_1 = -1000000000, R_1 = 1000000000;
		for (int e = head[u]; e; e = next[e])
			if (to[e] != fa[u] && g[to[e]])
			{
				if (L[to[e]] & 1)
				{
					appear_1 = 1;
					L_1 = std::max(L_1, L[to[e]]);
					R_1 = std::min(R_1, R[to[e]]);
				}
				else
				{
					appear_0 = 1;
					L_0 = std::max(L_0, L[to[e]]);
					R_0 = std::min(R_0, R[to[e]]);
				}
			}
		if (appear_0 && appear_1)
		{
			puts("No");
			return 0;
		}
		if (!appear_0 && !appear_1)
		{
			if (p[u])
			{
				g[u] = 1;
				L[u] = R[u] = w[u];
			}
			else
				g[u] = 0;
		}
		else
		{
			if (appear_0)
			{
				L[u] = L_0 - 1;
				R[u] = R_0 + 1;
			}
			else
			{
				L[u] = L_1 - 1;
				R[u] = R_1 + 1;
			}
			if (L[u] > R[u])
			{
				puts("No");
				return 0;
			}
			if (p[u])
			{
				if (w[u] < L[u] || w[u] > R[u] || (w[u] ^ L[u]) & 1)
				{
					puts("No");
					return 0;
				}
				L[u] = R[u] = w[u];
			}
			g[u] = 1;
		}
	}
	for (int i = 1; i <= N; i++)
	{
		int u = q[i];
		if (p[u])
			continue;
		if (u == 1)
			w[u] = L[u];
		else if (!g[u])
			w[u] = w[fa[u]] + 1;
		else if (L[u] <= w[fa[u]] + 1 && w[fa[u]] + 1 <= R[u])
			w[u] = w[fa[u]] + 1;
		else
			w[u] = w[fa[u]] - 1;
	}
	puts("Yes");
	for (int i = 1; i <= N; i++)
		printf("%d\n", w[i]);
	return 0;
}


Measured memory_bytes: 5504
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define pi 3.14159265358979323846
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

int main()
{

  int n,k; cin >> n >> k;
  if (n%k==0){cout << 0 << endl;}
  else {cout << 1 << endl;}

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=4050;
int t,n,m;
int arr[maxn];
char s[maxn];
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	ll fin=0;
	ll n0,n1,n2;
	n0=n1=n2=0;
	for(int i=1;i<=n;i++)
	{
		if(s[i]=='R') n0++;
		if(s[i]=='G') n1++;
		if(s[i]=='B') n2++;
 	}
	fin=n0*n1*n2;
	for(int len=1;;len++)
	{
		if(1+len+len>n) break;
		for(int i=1;;i++)
		{
			int j=i+len;
			int k=i+len*2;
			if(k>n) break;
			set<char> ss;
			ss.insert(s[i]);
			ss.insert(s[j]);
			ss.insert(s[k]);
		//	cout<<i<<j<<k<<"--"<<endl;
			if(ss.size()==3)
			{
				fin--;
			}
		}
	}
	cout<<fin<<endl;
	return 0;
}

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

const int N = 2e5;
int64_t solve(char* s)
{
  char*p,*q,*r;
  int64_t c=0,m=0,n=0;
  for (p=s;*p;m=0,p=r) {
    for(;*p&&*p!='A';p++){n=0;}
    for(q=p;*q=='A';q++) {n++;}
    for(r=q;r[0]=='B'&&r[1]=='C';r+=2) { m++; }
    c += m*n;
  };
  return c;
}

int main(int argc, char* argv[])
{
  char s[N+3];
  cin >> s;
  cout << solve(s) << '\n';
  return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int a, b, ans;
	char c;
	while (1)
	{
		scanf("%d %c %d",&a, &c, &b);
		if (c == '+'){
			ans = a + b;
		}
		else if (c == '-'){
			ans = a - b;
		}
		else if (c == '*'){
			ans = a*b;
		}
		else if (c == '/'){
			ans = a / b;

		}
		else if (c == '?'){
			break;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int w=n;
  int l[n],r[n];
  for(int i=0;i<w;i++){
    cin >> l[i] >> r[i];
    n=n+r[i]-l[i];
  }
  cout << n;
}


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

int main() {
	string s;
  	cin >> s;
  
  	int maxi = 0,sum = 0;
  
  	for(int i = 0; i < s.size(); i++) {
      	if(s.at(i) == 'A' || s.at(i) == 'T' || s.at(i) == 'G' || s.at(i) == 'C') {
        	sum++;
        }else {
        	maxi = max(sum,maxi);
          	sum = 0;
        }
    }
  
  	cout << max(sum,maxi) << endl;
}

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

int main() {
    int N;
    cin >> N;
    int odd;
    if(N%2==0) odd = N/2; else odd = N/2 + 1;
    double ans;
    ans = (double)odd/N;
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int tim = 0;
bool vis[107];
int G[107][107], d[107], f[107];
void dfs(int cur) {
	vis[cur] = true;
	d[cur] = ++tim;
	for (int i = 0; G[cur][i]; i++) {
		if (!vis[G[cur][i]]) dfs(G[cur][i]);
	}
	f[cur] = ++tim;
}
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
    	int u, k;
    	scanf("%d%d", &u, &k);
    	for (int j = 0; j < k; j++) {
    		scanf("%d", &G[u][j]);
		}
	}
	for (int i = 1; i <= n; i++) {
		if (!vis[i]) dfs(i);
	}
	for (int i = 1; i <= n; i++) {
		printf("%d %d %d\n", i, d[i], f[i]);
	}
    return 0;
}


Measured memory_bytes: 2720
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

int main(void){
	uint8_t a, b, c, d;
	scanf("%"SCNu8"%"SCNu8"%"SCNu8"%"SCNu8, &a, &b, &c, &d);
	puts((a-1)/d>=(c-1)/b?"Yes":"No");
}


Measured memory_bytes: 1620
import sys
n = int(sys.stdin.readline())
a = [int(i) for i in sys.stdin.readline().split()]
b = [int(i) for i in sys.stdin.readline().split()]

total = 0
for i, v in enumerate(b):
    m1 = min(v, a[i])

    total += m1
    a[i] -= m1

    if m1 == v:
        continue
    v -= m1

    m2 = min(v, a[i+1])
    total += m2
    a[i+1] -= m2
print(total)


Measured memory_bytes: 18624
import sys
N = 3

# 2次元配列
A = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    A.append(array)

A_t = [list(x) for x in zip(*A)]
A_n = [[A[0][0],A[1][1],A[2][2]],[A[0][2],A[1][1],A[2][0]]]
N = int(input())
B=[]
cnt = [0]*3
for i in range(N):
    B.append(int(input()))
    
num = 0
for j in A:
    for i in j:
        if i in B:
            cnt[num] += 1
    num +=1
if 3 in cnt:
    print("Yes")
    sys.exit(0)
cnt = [0,0,0]
num = 0
for j in A_t:
    for i in j:
        if i in B:
            cnt[num] += 1
    num +=1
if 3 in cnt:
    print("Yes")
    sys.exit()
cnt = [0,0,0]
num = 0
for j in A_n:
    for i in j:
        if i in B:
            cnt[num] += 1
    num +=1
if 3 in cnt:
    print("Yes")
else:
    print("No")

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

#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD=1e9+7;
const long double PI = acos(-1);
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N= 3e5+1;
 
typedef long long ll;
typedef long double ld;

void test_case()
{
    ll n,r,i,j;
    cin>>n>>r;
    if(n>=10)
    {
        cout<<r<<'\n';
    }
    else
        cout<<r+100*(10-n)<<'\n';

}
int main()
{
   IOS();
  
   test_case();
   return 0;
}



Measured memory_bytes: 256
// problem: "https://atcoder.jp/contests/abc155/tasks/abc155_d"

#include<bits/stdc++.h>
#define ll long long
#define p1 (ll)(-1e18)
#define p2 (ll)(1e18)

using namespace std;

ll negBS(ll i,ll j,ll M,ll k,vector<ll>&V)
{
    if(i > j)
        return 0;

    ll m = (i+j)/2;

    if(V[k] * V[m] < M)
        return max(negBS(i,m-1,M,k,V),(ll)(V.size()-m));

    return negBS(m+1,j,M,k,V);
}

ll posBS(ll i,ll j,ll M,ll k,vector<ll>&V)
{
    if(i > j)
        return 0;

    ll m = (i+j)/2;

    if(V[k] * V[m] < M)
        return max(posBS(m+1,j,M,k,V),(ll)(m-k));

    return posBS(i,m-1,M,k,V);
}


ll binarySearch(ll l,ll r,vector<ll>&V,ll k)
{
    if(l >= r-1)
        return l;

    ll m = (l+r)/2;
    ll i,c;
    c = 0;
    for(i=0;i!=V.size()-1;i++)
    {
        if(V[i] < 0)
            c += negBS(i+1,V.size()-1,m,i,V);       // define

        else
            c += posBS(i+1,V.size()-1,m,i,V);       // define
    }

    if(c <= k-1)
        return binarySearch(m,r,V,k);

    return binarySearch(l,m,V,k);
}

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

    vector<ll>V(n);
    ll i;
    for(i=0;i!=n;i++)
        cin>>V[i];

    sort(V.begin(),V.end());
    cout<<binarySearch(p1,p2,V,k);        // define

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll L;
	cin>>L;
	ld x = L;
	cout<<fixed<<setprecision(8)<<(x*x*x)/(27.00)<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
long long n, W;
long long w[110], v[110];

vector <long long> z[5];
 
 long long w0;
 
 bool friendlybool (long long a, long long b){
 	return (a>b);
 }
 
int main (){
 
	cin >> n >> W;
	for (int i=0; i < n; i++)
	{
		cin >> w[i] >> v[i];
		if (i==0) w0=w[i];
		z[w[i]-w0].push_back(v[i]);
		
	}
	
	for (int i=0; i < 4; i++)
	{
		sort (z[i].begin(), z[i].end(), friendlybool);
		for (int j=1; j< z[i].size(); j++)
			z[i][j]+=z[i][j-1]; 
	}
	
	long long sol=0;
	
	for (int i=0; i <= n && i*w0 <= W && i <= z[0].size(); i++)
	{
		for (int j=0; i+j <= n && i*w0+j*(w0+1) <= W && j <= z[1].size(); j++)
		{
			for (int k=0; i+j+k <= n && i*w0+j*(w0+1)+k*(w0+2) <= W && k <= z[2].size(); k++)
			{
				for (int l=0; i+j+k+l <= n && i*w0+j*(w0+1)+k*(w0+2)+l*(w0+3) <= W && l <= z[3].size(); l++)
				{
					
					long long trensol=0;
					if (i) trensol+=z[0][i-1];
					if (j) trensol+=z[1][j-1];
					if (k) trensol+=z[2][k-1];
					if (l) trensol+=z[3][l-1];
					sol=max(trensol, sol);
				}
			}
		}
	}
	
	cout << sol;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n;
  cin>>n;
  bool ok=false;
  rep(i,0,26){
   rep(j,0,16){
     if(i*4+j*7==n){
       ok=true;
       break;
     }
   }
    
  }
  if(ok) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}






//全探索

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

int main() {
    int x; cin >> x;
    int ans = (x / 500) * 1000;
    x %= 500;
    ans += (x / 5) * 5;
    cout << ans << endl;
}


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


int main(){
 char a[101];
 char b[101];
 char c[101];

 scanf("%s %s %s", a, b, c);

 int x = strlen(a);
 int y = strlen(b);

 if(a[x-1] == b[0] && b[y-1] == c[0]){
     printf("YES\n");
 }
 else{
     printf("NO\n");
 }

 return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x) // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n, m;
    cin >> n >> m;
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<>> q;
    for (ll i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        q.push(make_pair(a, b));
    }
    ll ans = 0;
    while (m > 0)
    {
        ll h = min(m, q.top().second);
        ans += q.top().first * h;
        m -= h;
        q.pop();
    }
    cout << ans << endl;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
#define DOUBLE(d) cout << fixed << setprecision(15) << (d) << endl

const int MAX = 2e5+10;
const int ALPHA = 26;

string S;

vvii nxt;

string solve() {
    int sz = S.size();
    nxt = vvii(sz+1, vii(ALPHA));
    vii state(ALPHA+1, ii(-1, 0));

    REPR (i, sz) {
        ll mn = MAX;
        REP (a, ALPHA) { 
            nxt[i+1][a] = state[a];
            CHMIN(mn, state[a].second);
        }
        int al = S[i] - 'a';
        state[al].first = i;
        state[al].second = mn+1;
    }
    nxt[0] = vii(26);
    REP (a, ALPHA) nxt[0][a] = state[a];

    int idx = 0;
    string ans = "";
    while (1) {
        ii n(-1, MAX);
        int c = 0;
        REP (a, ALPHA) {
            if (nxt[idx][a].second < n.second) {
                n = nxt[idx][a];
                c = a;
            }
        }
        ans += c + 'a';
        if (n.first == -1) return ans;
        idx = n.first + 1;
    }
}

int main() {
    cin >> S;
    cout << solve() << endl;
}

Measured memory_bytes: 89476
using System;

class ABC_132_B
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());

        string[] input = Console.ReadLine().Split(' ');
        int[] p = new int[N];
        for (int i = 0; i < N; i++)
        {
            p[i] = int.Parse(input[i]);
        }

        int ans = 0;
        for (int i = 0; i < N-2; i++)
        {
            if(p[i] < p[i+1] && p[i+1] < p[i+2]) ans++;
            else if(p[i] > p[i+1] && p[i+1] > p[i+2]) ans++;
        }

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
S = gets.chomp
T = gets.chomp

pos = Hash.new {|h,k| h[k] = [] }
S.each_char.with_index(1) {|c,i| pos[c] << i }

i = 0
l = 0
T.each_char do |c|
  a = pos[c]
  if a.empty?
    puts -1
    exit
  end
  i = pos[c].bsearch {|j| i < j }
  if i == nil
    i = 0
    l += 1
    redo
  end
end
puts i + S.size * l


Measured memory_bytes: 5116
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,a;
    cin>>n>>a;
    ll g=a;
    for(ll i=0;i<n-1;i++){
        cin>>a;
        g=gcd(g,a);
    }
    cout<<g<<endl;
    return 0;
}

Measured memory_bytes: 256
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,m,ans=0,i;
  cin >> n >> m;
  for(i=1; i*i<=m; i++) {
    if(m%i==0) {
      if(i*n<=m) {
        ans=max(ans,i);
      }
      if(m%(m/i)==0&&m/i*n<=m) {
        ans=max(ans,m/i);
      }
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
        int i = 1, j = 0;
        int data[100];
        int max = 0;
        int count[100];


        for(j = 0; j < 100 ;j++)
        {
                data[j] = 0;
                count[j+1] = 0;
        }

        while(scanf("%d",&data[i]) != EOF)
        {
                for(j = 1; j <= 100 ;j++)
                {
                        if(j == data[i])
                        {
                                count[j]++;
                        }
                }
                i++;
        }
        max = count[1];
        for(i = 1; i <= 100;i++)
        {
                if(max < count[i])
                {
                        max = count[i];
                }
        }
        for(i = 1; i <= 100; i++)
        {
                if(max == count[i])
                {
                        printf("%d\n",i);
                }
        }
        return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define va first
#define vb second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int N, K, Q, x, cnt;
int A[101010];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);

	cin >> N >> K >> Q;
	for (int i=0; i<Q; i++) {
		cin >> x; A[x]++;
	}

	for (int i=1; i<=N; i++) {
		if (A[i] <= Q-K) cout << "No";
		else cout << "Yes";

		cout << '\n';
	}
}

Measured memory_bytes: 1024
#pragma GCC optimize(3)
#include<iostream>
#include<iomanip>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<set> 
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#define ll long long
#define db double
#define inf 5001
#define INF (int)1e8 
#define pi acos(-1)
#define rd(n) {n=0;char ch;int f=0;do{ch=getchar();if(ch=='-'){f=1;}}while(ch<'0'||ch>'9');while('0'<=ch&&ch<='9'){n=(n<<1)+(n<<3)+ch-48;ch=getchar();}if(f)n=-n;}
using namespace std;
int n;

struct edge{
	int y,nxt;
	edge(){}
	edge(int yy,int nn){
		y=yy,nxt=nn;
	}
}e[inf];
int head[inf],ecnt;

void addedge(int x,int y){
	ecnt++;
	e[ecnt]=edge(y,head[x]);
	head[x]=ecnt;
	return;
}

int w[inf],f[inf],dp[2][inf];

void memset(int now){
	for (int i=0;i<inf;i++){
		dp[now][i]=INF;
	}
	return;
}

void dfs(int u){
	for (int i=head[u];i;i=e[i].nxt){
		dfs(e[i].y);
	}
	int now=0;
	memset(0);
	dp[now][0]=0;
	for (int i=head[u];i;i=e[i].nxt){
		int v=e[i].y;
		now^=1;
		memset(now);
		for (int j=0;j<=w[u];j++){
			if (j-w[v]>=0){
				dp[now][j]=min(dp[now][j],dp[now^1][j-w[v]]+f[v]);
			}
			if (j-f[v]>=0){
				dp[now][j]=min(dp[now][j],dp[now^1][j-f[v]]+w[v]);
			}
		}
	}
	f[u]=INF;
	for (int i=0;i<=w[u];i++){
		f[u]=min(f[u],dp[now][i]);
	}
	return;
}

int main(){
	rd(n)
	int x;
	for (int i=2;i<=n;i++){
		rd(x)
		addedge(x,i);
	}
	for (int i=1;i<=n;i++){
		rd(w[i])
	}
	dfs(1);
	if (f[1]>=INF){
		puts("IMPOSSIBLE");
	}
	else{
		puts("POSSIBLE");
	}
	return 0;
}

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

using namespace std;

#define REP(i, x, y) for (int i = x; i < y; i++)

const int8_t  INFC = 0x3f;
const int16_t INFS = 0x3f3f;
const int32_t INF  = 0x3f3f3f3f;
const int64_t INFL = 0x3f3f3f3f3f3f3f3fLL;
const int     MAXN = 2e5;
const int     MOD  = 1e9 + 7;

vector<int> G[ MAXN ];
int         f[ MAXN ][ 2 ];

int dfs(int x, int la)
{
    f[ x ][ 0 ] = f[ x ][ 1 ] = 1;
    for (int i = 0; i < G[ x ].size(); i++)
        if (la != G[ x ][ i ])
        {
            dfs(G[ x ][ i ], x);
            f[ x ][ 0 ] = 1LL * f[ x ][ 0 ] * (f[ G[ x ][ i ] ][ 0 ] + f[ G[ x ][ i ] ][ 1 ]) % MOD;
            f[ x ][ 1 ] = 1LL * f[ x ][ 1 ] * f[ G[ x ][ i ] ][ 0 ] % MOD;
        }
}

int main()
{
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; i++)
    {
        int x, y;
        cin >> x >> y;
        --x, --y;
        G[ x ].push_back(y);
        G[ y ].push_back(x);
    }
    dfs(0,-1);
    cout <<(f[0][0]+f[0][1])%MOD << endl;
    return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	int a, b;
	bool operator < (ii o) const { return make_tuple(a, b) < make_tuple(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, M, Q, x, y, z;

lint N, K;

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif
	
	scanf("%lld", &K);
	N = 50;
	lint upper = (K%N == 0? K: K - K%N + N);
	lint selisih = upper-K;
	lint normal = N + upper/N - 1;
	printf("%lld\n", N);
	bool ada = 0;
	for (int i = 0; i < selisih; i++) {
		if (ada) printf(" ");
		printf("%lld", normal-N+selisih-1);
		ada = 1;
	}
	for (int i = selisih; i < N; i++) {
		if (ada) printf(" ");
		printf("%lld", normal+selisih);
		ada = 1;
	}
	puts("");
		
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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



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

	cout << (A - 1)*(B - 1) << endl;
	return 0;
}



Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
int main(){
    string s;
    cin >> s;
    if(s=="Sunny") cout << "Cloudy" << endl;
    else if(s=="Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
#define all(v) v.begin(), v.end()
#define rall(x) (x).rbegin(), (x).rend()
#define pll pair<long long, long long>
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define vc vector<char>
#define vvc vector<vc>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
template <class T>bool chmax(T &a, const T &b){if (a < b){a = b;return 1;}return 0;}
template <class T>bool chmin(T &a, const T &b){if (b < a){a = b;return 1;}return 0;}
//snippets:tmp,cl,cvl,cs,co,coy,con,cov,setp



int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];
    ll ans=0;
    rep(i,n){
        if(i==0) continue;
        if(a[i]>=a[i-1]) continue;
        ans+=a[i-1]-a[i];
        a[i]=a[i-1];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4724
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
// bool operator<(const pair<int, int> &a, const pair<int, int> &b)
// {
//     if (a.first == b.first)
//         return a.second < b.second;
//     return a.first < b.first;
// };

/*unsigned int xor128(void)
{
    static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned int t = (x ^ (x << 11));
    x = y;
    y = z;
    z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
unsigned int xor128rnd(unsigned int m)
{
    return xor128() % m;
}*/

/*bool operator<(const pair<int, int> &a, const pair<int, int> &b)
{
    if (a.first == b.first)
    {
        return a.second < b.second;
    }
    return a.first < b.first;
}*/

int N, H, W;
double arr[3000];
double dp[3000][3000];
vector<int> v1, v2;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(12);
    cin >> N >> H >> W;

    cout << (N - H + 1) * (N - W + 1) << endl;
    return 0;
}

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

int main(){
    int arr[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n;cin>>n;
    cout<<arr[n-1];
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;


int main(void){
  double n,m,d;
  
  cin >> n >> m >> d;
  
  if (d==0.0) printf("%.12lf\n",(m-1)/n);
  else printf("%.12lf\n",(n-d)*2*(m-1)/(n*n));
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m,max,s,i;
  int d[100001];
  while(1){
    scanf("%d %d",&n,&m);
    if(!(n||m))break;
    s=0;
    for(i=0;i<n;i++){
      scanf("%d",&d[i]);
      if(i<m)s+=d[i];
    }
    max=s;
    for(i=m;i<n;i++){
      s-=d[i-m];
      s+=d[i];
      if(max<s)max=s;
    }
    printf("%d\n",max);
  }
  return 0;
}

Measured memory_bytes: 988
using System;

namespace _115c
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] NK = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            int[] h = new int[NK[0]];
            for(int i = 0; i < h.Length; i++){
                h[i] = int.Parse(Console.ReadLine());
            }
            Array.Sort(h);
            int res = 1000000000;
            for(int i = 0; i <= NK[0]-NK[1];i++){
                res = Math.Min(res,h[i+NK[1]-1]-h[i]);
            }
            Console.WriteLine(res);
        }
    }
}

Measured memory_bytes: 17344
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll l, r, d;
    cin >> l >> r >> d;

    ll ans = 0;
    for(ll i = l; i <= r; i++){
        if(i % d == 0) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include "bits/stdc++.h"

using namespace std;
using int64 = long long int;

constexpr int MaxN = 100000 + 10;
constexpr int64 Inf = 1LL << 60;
int64 A[MaxN];
int64 memo[MaxN][2];
int n;

int64 Solve(int no, int negated)
{
    if (no == n - 1)
    {
        return negated ? -A[no] : A[no];
    }

    if (memo[no][negated] != Inf)
    {
        return memo[no][negated];
    }

    int64 value = negated ? -A[no] : A[no];
    return memo[no][negated] = max(Solve(no + 1, false) + value, Solve(no + 1, true) - value);
}

int main()
{
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }

    fill((int64 *) memo, (int64 *) memo + MaxN * 2, Inf);

    cout << Solve(0, false) << endl;
}

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

int main(){
  int n,a;
  cin >> n >> a;
  int ex = n % 500;
  if(ex <= a) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int Maxn=1e5+5;
const int inf=1<<30;
inline int R()
{
	char c;int sign=1,res=0;
	while((c=getchar())>'9'||c<'0') if(c=='-') sign=-1;
	res+=c-'0';
	while((c=getchar())>='0'&&c<='9') res=res*10+c-'0';
	return res*sign;	
}
struct range
{
	int l,r;
}a[Maxn],st[Maxn];
int n,k,s;
int main()
{
	n=R();k=R();s=R();
	for(int i=1;i<=k;i++)
		printf("%d ",s);
		for(int i=k+1;i<=n;i++)
		{
			if(s>1000) printf("%d ",s-1);
			else printf("%d ",s+1);
		}
	puts("");
}

Measured memory_bytes: 1280