akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define MOD 1000000007


#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(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()


#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }
 
//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

 
signed main(){
 
   int N;
   string S;

   cin >>N;
   cin >>S;

    int x=0;
    int y=0;
    int z=N;

    int kuro[N];
    int siro[N];

    int ans=N;

   rep(i,N){
       if(S[i]=='#'){
           x++;
       }
       kuro[i] = x;
   }

   for(int i=N-1;i>=0;i--){
       if(S[i]=='.'){
           y++;
       }
       siro[i] = y;
   }



    rep(i,N-1){
        ans = min(ans,kuro[i]+siro[i+1]); 
    }



  

    if(x==0||y==0){
        cout << "0"<<endl;
        return 0;
    }



   int ans2 = min({x,y,ans});

   cout <<ans2 <<endl;

    return 0;
 
}


Measured memory_bytes: 3716
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::ops::Bound::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout]
fn main() {
    input! {
        x: [i64; 2], y: [i64; 2]
    }

    let mut ans = -1i64<<60;
    for i in 0..2 {
        for j in 0..2 {
            ans = max(ans, x[i] * y[j]);
        }
    }
    println!("{}", ans);

}


Measured memory_bytes: 2172
import java.util.*;
public class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		int M=sc.nextInt();
		
		String[] a=new String[N];
		String[] b=new String[M];
		for(int i=0;i<N;i++){
			a[i]=sc.next();
		}
		for(int i=0;i<M;i++){
			b[i]=sc.next();
		}
		for(int i=0;i<=N-M;i++){
			for(int j=0;j<=N-M;j++){
				if(a[i].substring(j,j+M).equals(b[0])){
					if(sub(a,b,i,j)==1){
						System.out.println("Yes");
						
						return;
					}
				}
			}
		}
		System.out.println("No");				

	}
	static int sub(String[]a ,String[]b,int i,int j){
		for(int k=0;k<b.length;k++){
			if(!a[i+k].substring(j,j+b.length).equals(b[k])){
				return 0;
			}
		}
		return 1;
	}
}

Measured memory_bytes: 21972
from numpy import *;i=int32;p=input;q=searchsorted;N=int(p());A=i(p().split());B=i(p().split());c=0;
for k in range(1,30):
  a,b=sort(hstack((A%(1<<k),A%(1<<k)-2**k))),B%(1<<k);c+=(sum(q(a,2**k-b)-q(a,2**(k-1)-b)))%2*2**(k-1)
print(c)


Measured memory_bytes: 37060
#!/usr/bin/env python3

MOD = 10**9
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

A, B, C, X, Y = map(int, input().split())
AB = 2*C

xy_min = 0
xy_max = 0
if X > Y:
    xy_min = Y
    xy_max = X
else:
    xy_min = X
    xy_max = Y

ans2 = xy_max*AB


ans = 0
if A+B > AB:
    ans += AB*xy_min
    X -= xy_min
    Y -= xy_min

    ans += A*X
    ans += B*Y
else:
    ans += A*X
    ans += B*Y

print(min(ans, ans2))


Measured memory_bytes: 3064
H,W=map(int,input().split())

A=[list(map(int,input().split())) for _ in range(H)]
B=[list(map(int,input().split())) for _ in range(H)]

#dp[i][j]=マス(i,j)における可能なポイントのリスト
dp=[[set() for _ in range(W)] for _ in range(H)]
dp[0][0].add(0)

for i in range(W+H-1):
  I,J=0,0
  if i < H:
    I=i
    J=0
  else:
    I=H-1
    J=i-H+1
  while I>=0 and J<W:
    sa = abs(A[I][J] - B[I][J])
    for point in dp[I][J]:
      if I!=H-1:
        dp[I+1][J].add(point+sa)
        dp[I+1][J].add(abs(point-sa))
      if J!=W-1:
        dp[I][J+1].add(point+sa)
        dp[I][J+1].add(abs(point-sa))
    I-=1
    J+=1

ans=dp[H-1][W-1]
sa = abs(A[H-1][W-1] - B[H-1][W-1])
res=float("inf")
for p in ans:
  res=min(res,abs(p+sa),abs(p-sa))
print(res)

Measured memory_bytes: 539056
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL


typedef struct{
	int s,g;
}Time;

void swap_Time(Time *x, Time *y) {
	Time tmp = *x;
	*x = *y;
	*y = tmp;
}

void sort_by_s(Time a[], int n) {
	for (int i = 0; i < n - 1; i++) {
		for (int j = n - 1; j > i; j--) {
			if (a[j - 1].s > a[j].s)swap_Time(&a[j - 1], &a[j]);
		}
	}
}


int main() {
	int   hhs, mms, sss, hhg, mmg, ssg, cnt = 1;
	Time yamanote[10000];
	bool f[10000];
	for (int n; cin >> n&&n;) {
		for (int i = 0; i < n; i++) {
			char c;
			cin >> hhs >> c >> mms >> c >> sss >> hhg >> c >> mmg >> c >> ssg;

			yamanote[i].s = 3600 * hhs + 60 * mms + sss;
			yamanote[i].g = 3600 * hhg + 60 * mmg + ssg;
			f[i]=0;
		}

		sort_by_s(yamanote, n);

		for (int i = 1; i < n; i++) {
			for (int j = 0; j < i;) {
	
				if (f[j] == 1) { j++; continue; }
				if (yamanote[i].s >= yamanote[j].g) {
					f[j] = 1;
					break;
				}
				j++;
				if (j == i)cnt++;
			}
			
		}
		
		cout << cnt << endl;
		cnt = 1;

	}
	return 0;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>   
using namespace std;
#define N 3005   
#define REP(i, n) for(int i=0; i<n; i++)
int n;
int a[N];
int alice,bob;
int main(){
 scanf("%d",&n);
 REP(i,n)scanf("%d",&a[i]);
 sort(a,a+n,greater<int>());
 REP(i,n){
    if(i%2==0){
       alice+=a[i]; 
    }else{
       bob+=a[i];
    }
 }
    
 cout << alice - bob << endl;
}

Measured memory_bytes: 256
#coding:utf-8
s = int(input())

a = []
i = 0

#リストに同じ要素がある場合，Trueを返す．
def is_not_unique(seq):
    return len(seq)  != len(set(seq))

while True:
    if i == 0:
        a.append(s)
        i += 1
    elif is_not_unique(a):
        out_flag = i
        break 
    elif a[i-1] % 2 == 0:
        a.append(a[i-1] / 2)
        i += 1
    elif a[i-1] % 2 == 1:
        a.append(3 * a[i-1] + 1)
        i += 1
    
def out(x):
    print(x)

out(out_flag)

Measured memory_bytes: 3064
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

pi = 3.14

r = I()

print(2*r*3.14)

Measured memory_bytes: 27164
#include <stdio.h>
 
class Dice{
public:
    Dice(){
        number = new int[6];
        work = new int[6];
    };
    ~Dice(){
        delete[] number;
        delete[] work;
    };
 
    void setLabel(int index,int num){
        number[index] = num;
    };
 
    void roll(char dst){
        for(int i = 0; i < 6; i++) work[i] = number[i];
        switch(dst){
        case 'E':
            setNumber(work[3],work[1],work[0],work[5],work[4],work[2]);
            break;
        case 'N':
            setNumber(work[1],work[5],work[2],work[3],work[0],work[4]);
            break;
        case 'S':
            setNumber(work[4],work[0],work[2],work[3],work[5],work[1]);
            break;
        case 'W':
            setNumber(work[2],work[1],work[5],work[0],work[4],work[3]);
            break;
        }
    };
 
    int returnPeek(){
        return number[0];
    }
 
private:
    void setNumber(int n0,int n1,int n2,int n3,int n4,int n5){
        number[0] = n0;
        number[1] = n1;
        number[2] = n2;
        number[3] = n3;
        number[4] = n4;
        number[5] = n5;
    }
 
private:
    int* number;
    int* work;
};
 
int main(){
    Dice dice;
    int label;
    char ch;
    for(int i = 0; i < 6; i++){
        scanf("%d",&label);
        dice.setLabel(i,label);
    }
    getchar(); 
    while((ch = getchar()) != '\n'){
        dice.roll(ch);
    }
    printf("%d\n",dice.returnPeek());
}


Measured memory_bytes: 2752
import sys
from io import StringIO
import unittest
import math

def resolve():
    a, b, n = map(int, input().split())

    # for i in range(n, 0, -1):
    #     print(i, math.floor((a * i) / b) - a * math.floor(i / b))

    # if n // b * b - 1 >= 0:
    # if b <= n:
    #     n = n // b * b - 1
    # 
    # if (a * n) % b == 0:
    #     n -= 1

    n = min(b - 1, n)

    ans = math.floor((a * n) / b) - a * math.floor(n / b)

    # print('ans')
    # print(n, ans)
    print(ans)

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """5 7 4"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """11 10 9"""
        output = """9"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Measured memory_bytes: 16208
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;


using namespace std;

#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

ll gcd(ll x, ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv)
{
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	int n; cin >> n;
	vll a(n); rep(i,n) cin >> a[i];
	vvll dp(n,vll(n,LL_INF));
	rep(i,n) dp[i][i]=0;
	rep2(len,1,n)rep2(l,0,n-len){
		int r = l+len;
		ll sum = 0;
		rep2(m,l,r){
			dp[l][r] = min(dp[l][r],dp[l][m]+dp[m+1][r]);
			sum += a[m];
		}
		dp[l][r] += sum+a[r];
	}

	out(dp[0][n-1]);
}




Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
int sa(int n, int m) {
	if (n >= 0) {
		if (m >= 0)
			return max(n, m) - min(n, m);
		else
			return n + abs(m);
	}
	else {
		if (m >= 0)
			return m - n;
		else
			return abs(min(n, m)) - abs(max(n, m));
	}
}
int main() {
	static ll n, ans = 0, bns = 0, A[202020];
	cin >> n;
	rep(i, n) {
		cin >> A[i];
		A[i] -= (i + 1);
	}
	sort(A, A + n);
	rep(i, n) {
		ans += sa(A[i], A[n / 2 - 1]);
		bns += sa(A[i], A[n / 2]);
	}
	cout << min(ans, bns) << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<Integer> d = new ArrayList<>();
        for(int i=0; i<N; i++){
            d.add(scanner.nextInt());
        }
        Collections.sort(d);
        int from = d.get(N/2-1);
        int to = d.get(N/2);
        System.out.println(to-from);
    }
}

Measured memory_bytes: 59836
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <deque>

using namespace std;

const int mod = 1e9 + 7;

deque<int> x, y;
long long dfs(int which, long long val) {
	auto &deq = which == 0 ? x : y;
	if (deq.size() < 2) {
		return val;
	}

	long long w = deq.back() - deq.front();

	// area = w * h * (deq.size() - 1) の h->1と考える
	val += w * (deq.size() - 1); // - 2 + 1
	val %= mod;
	deq.pop_front();
	deq.pop_back();
	return dfs(which, val);
}

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

	for (int i = 0; i < n; i++) {
		cin >> tmp;
		x.push_back(tmp);
	}
	for (int i = 0; i < m; i++) {
		cin >> tmp;
		y.push_back(tmp);
	}

	long long w = x.back() - x.front();
	long long h = y.back() - y.front();

	long long a = dfs(0, 0);
	long long b = dfs(1, 0);

	// printf("a   %10lld\n", a);
	// printf("b   %10lld\n", b);
	// printf("a+b %10lld\n", (a+b)%mod);
	// printf("a*b %10lld\n", (a*b)%mod);

	long long ans = a * b % mod;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

struct st{
	int x;
	int y;
	int time;
};

int main(){
	int N;
	cin>>N;
	vector<st> plan(N+1);
	plan[0].x = 0; plan[0].y = 0;
	plan[0].time = 0;
	REP(i,N)cin>>plan[i].time>>plan[i].x>>plan[i].y;
	bool ok = true;
	REP(i,N){
		int t = plan[i].time - plan[i-1].time;
		int dis = abs(plan[i].x - plan[i-1].x) + abs(plan[i].y - plan[i-1].y);
		if(t<dis)ok = false;
		if(t % 2 != dis % 2)ok = false;
	}
	cout<<((ok)?"Yes":"No")<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define pb push_back
#define mp make_pair
#define Size(x) ((int)((x).size()))
#define rep(i, l, r) for(int (i) = (l); (i) <= (r); ++(i))
#define per(i, r, l) for(int (i) = (r); (i) >= (l); --(i))
#define chkmax(x, y) (x) = max((x), (y))
#define chkmin(x, y) (x) = min((x), (y))
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
inline char gc() {
	static char now[1<<16], *S, *T;
	if(S == T) {T = (S = now) + fread(now, 1, 1<<16, stdin); if(S == T) return EOF;}
	return *S++;
}
#define gc getchar
inline int read() {
	int x = 0, f = 1; char c = gc();
	while(c < '0' || c > '9') {(c ^ '-') ? 0 : (f = 0); c = gc();}
	while(c >= '0' && c <= '9') {x = (x << 3) + (x << 1) + (c ^ 48); c = gc();}
	return f ? x : ((~x) + 1);
}
#define N 100010
int n, m;
VI con[N], ans;
bool vis[N];
void dfs(int x, int rt) {
	for (int y : con[x]) {
		if (vis[y] || y == rt) continue ;
		vis[y] = 1; ans.pb(y); dfs(y, rt);
		return ;
	}
}
int main() {
	n = read(); m = read();
	for (int i = 1; i <= m; ++ i) {
		int u = read(), v = read();
		con[u].pb(v);
		con[v].pb(u);
	}
	dfs(1, 1);
	reverse(ans.begin(), ans.end());
	dfs(con[1][0], con[1][0]);
	printf("%d\n", (int)ans.size());
	for (int x : ans) printf("%d ", x);
	puts("");
	return 0;
}

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

signed main() {
	int n, d; cin >> n >> d;
	d = d + d + 1;
	cout << (n + d - 1) / d << endl;
}

Measured memory_bytes: 256
H,W,K = map(int,input().split())
array = [ list(input()) for k in range(H)]
ans = 0
for bit_row in range(2**H):
  for bit_line in range(2**W):
    count = 0
    for i in range(H):
      for j in range(W):
        if ( bit_row >> i ) & 1 == 0 and ( bit_line >> j ) & 1 == 0:
          if array[i][j] == '#':
            count += 1
    if count == K:
      ans += 1
print( ans )

Measured memory_bytes: 9060
#include<stdio.h>

int main(){
    double num[3];
    int numd[3];
    int i, ans2;
    double ans;

    for(i=0; i<3; i++){
        scanf("%d", &numd[i]);
        num[i] = (double)numd[i];
    }

    ans = (int)((numd[2]+0.5) / numd[0]) * numd[1];
    ans2 = (int)ans;

    printf("%d", ans2);
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

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

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX];
long long finv[MAX];
long long inv[MAX];  // mod MOD k の逆元 inv[k]

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;

  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 順列計算
long long perm(long long a, long long b) {
  if (a < b) return 0;
  long long tmp = finv[a - b] % MOD;
  return tmp * fac[a] % MOD;
}
//* Mod int
const int mod = 1000000007;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
typedef vector<mint> vm;
typedef vector<vm> vvm;
//*/

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  COMinit();
  int n, k;
  cin >> n >> k;
  VLL a(n);
  rep(i, n) cin >> a[i];
  sort(all(a));
  mint ans = 0;
  rep(i, n - k + 1) { 
    ans -= a[i] * COM(n - (i + 1), k - 1);
    // cout << a[i] << " " << COM(n - (i + 1), k - 1) << " ko" << endl;
  }

  reverse(all(a));
  rep(i, n - k + 1) ans += a[i] * COM(n - (i + 1), k - 1);

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


Measured memory_bytes: 13056
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())printf("%d ",v[_]);cout<<"\n";}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};//RDLU
#define yes puts("YES")
#define no puts("NO")

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,a,b;
	cin>>n>>a>>b;
	a=n-a+1;
	b=n-b+1;
	cout<<a*b<<endl;
}









Measured memory_bytes: 256
n=int(input())
mark=[i for i in range(0,3200,400)]
mark.append(99999999999999)
def color(x):
    for i in range(9):
        if mark[i]<=x<mark[i+1]:
            return i     
score=list(map(int,input().split()))
set=set()
special=0
for x in score:
    if x<3200:
        set.add(color(x))
    else:
        special+=1
        
print(max(len(set),1),len(set)+special)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

bool ch[52];
int main() {
	ll n,k;
	cin>>n>>k;
	for(ll i=0;i<k;i++){
		ll now;
		cin>>now;
		for(ll j=0;j<now;j++){
			ll nex;
			cin>>nex;
			nex--;
			ch[nex]=true;
		}
	}
	ll ans=0;
	for(ll i=0;i<n;i++){
		if(ch[i]!=true){
			ans++;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define Boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

long GCD(long a,long b) {
    if(b==0) return a;
    return GCD(b,a%b);
}

void GeneratePrime(vector <long> &P,long n) {
    P[0] = P[1] = 1;
    for(int i=2;i<n;i++) {
        if(P[i]!=0) continue;
        for(int j=2*i;j<n;j+=i) if(P[j]==0) P[j] = i;
        P[i] = i;
    }
}

void Crack() {
	long n,a;
    cin >> n;
    vector <long> A(n);
    for(int i=0;i<n;i++) cin >> A[i];

    long gcd = A[0];
    for(int i=1;i<n;i++) {
        gcd = GCD(gcd,A[i]);
        if(gcd==1) break;
    }

    long m = 1000001;
    vector <long> P(m,0);
    GeneratePrime(P,m);

    vector <long> V(m,0);
    int flag = 0;
    for(int i=0;i<n;i++) {
        if(A[i]<2) continue;
        a = A[i];
        if(V[a]!=0) {flag = 1;break;}
        V[a] = i;
        if(V[P[a]]!=0 && V[P[a]]!=i) {flag = 1;break;}
        V[P[a]] = i;
        while(a!=P[a]) {
            a /= P[a];
            if(V[a]!=0 && V[a]!=i) {flag = 1;break;}
            V[a] = i;
            if(V[P[a]]!=0 && V[P[a]]!=i) {flag = 1;break;}
            V[P[a]] = i;
        }
    }

    if(flag==0) cout << "pairwise coprime" << endl;
    else if(gcd==1) cout << "setwise coprime" << endl;
    else cout << "not coprime" << endl;
}

int main() {
	Boost;
    Crack();
	return 0;
}

Measured memory_bytes: 26640
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	//min(a,b)...a,bの小さいほう
	//max(a,b)...     大きいほう
	int a;
	//int b;
	//int c;
	//int d;
	int e;
	std::cin >> a;
	cout << a / 3 << "\n";
	std::cin >> e;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <set>
#include <bitset>
#include <limits>

using namespace std;

#define ll long long

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

cout << a*b << endl;

    return 0;
}

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

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

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	char a[10];
	int t[10]={};
	int b=0;
	int c=0;
	scanf("%s",&a);
	for(int i=0;i<10;i++){
		if(a[i]=='A'||a[i]=='T'||a[i]=='G'||a[i]=='C')
			t[i]=1;
	}
	for(int i=0;i<10;i++){
		if(t[i]==1)
			c++;
		else
			c=0;
		if(c>b)
			b=c;
	}
	printf("%d",b);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;

int main() {
    string s;
    cin >> s;
    if (s == "a" || s == "e" || s == "i" || s == "o" || s == "u") {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
int main(){
  int A,B,C,D=0;
  str N,N2;
  cin>>N;
  N.at(3)='8';
  cout<<N<<endl;
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=input.split("\n");
var str="";
for(var i=0;i<Arr.length;i++){
var arr=Arr[i].split(" ").map(Number);
var h=arr[0];
var w=arr[1];
if(h===0 && w===0)break;
if(i!==0)str+="\n";
var W0=(Array(w+1).join("#.")).slice(0,w)+"\n";
var W1=(Array(w+1).join(".#")).slice(0,w)+"\n";
for(var j=0;j<h;j++)str+=(j%2===0)?W0:W1;
}
console.log(str);

Measured memory_bytes: 7644
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int cans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

int main(){
    int N;
    int cnt = 0;
    int d1,d2;
    cin >> N;
    bool f = false;
    rep(i,N) {
	cin >> d1 >> d2;
	if(d1 == d2) cnt++;
	else cnt = 0;
	if(cnt == 3) f = true;
    }

    cans(f);
    return 0;
}



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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n, d;
    cin >> n >> d;
    d = 2 * d + 1;
    cout << (n - 1) / d + 1 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int N=0,j=0,c=0,count=0;
    scanf("%d",&N);
    for(int i=1;i<=N;i++)
    {   j=i;
        while(j!=0)
        {
            j=j/10;
            ++c; 
        }
        if(c%2!=0)
        {
            count++;
        }
        c=0;
    }

    printf("%d",count);
    return 0;
}


Measured memory_bytes: 1724
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,l;
	cin>>n>>l;
	vector<int>arr(n);
	int sum=0;
	for(int i=0;i<n;i++){
		arr[i]=l+i;
		sum+=arr[i];
	}
	int res=INT_MAX;
	int result;
	for(int i=0;i<n;i++){
		int cur_sum=0;
		for(int j=0;j<n;j++){
			if(i==j)
				continue;
			cur_sum+=arr[j];
		}
		if(res>(abs(sum-cur_sum))){
			res=abs(sum-cur_sum);
			result=cur_sum;
		}
	}
	cout<<result;
	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
g = [list() for _ in range(n)]
for _ in range(m):
  s,t = map(int,input().split())
  g[s-1].append(t-1)
prop = [0]*n
expc = [10**6]*n
prop[0] = 1
expc[-1] = 0
for i in range(n):
  if not g[i]:
    continue
  t = len(g[i])
  for x in g[i]:
    prop[x] += prop[i]/t
for i in range(n-1,-1,-1):
  if not g[i]:
    continue
  t = len(g[i])
  f = 0
  for x in g[i]:
    f += expc[x] + 1.0
  f /= t
  expc[i] = f

cans = expc[0]
for i in range(n-1):
  t = len(g[i])
  if t < 2:
    continue
  c = max(expc[x] for x in g[i])
  ne = (expc[i]*t - (c+1))/(t-1)
  de = expc[i] - ne
  na = expc[0] - de*prop[i]
  if cans > na:
    cans = na
print(cans)

Measured memory_bytes: 9364
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

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

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

int ary[60];

int main(){ _;
  int n,p;
  while(cin>>n>>p,!(n==0&&p==0)){
    REP(i,n)ary[i]=0;
    int rest=p;

    for(;;){
      REP(i,n){
	if(rest==0){
	  if(ary[i]==p){
	    cout<<i<<endl;
	    goto found;
	  }else swap(ary[i],rest);
	}else{
	  rest--;
	  ary[i]++;
	}
      }
    }
  found:;
  }
}

Measured memory_bytes: 1192
import math

def cut_num(length,max_length):
    return math.ceil(length/max_length)-1

n,k = map(int,input().split())
a = list(map(int,input().split()))

l = 1
r = 10**9

while l<r:
    mid = (l+r)//2
    count = 0
    for i in range(n):
        count += cut_num(a[i],mid)
    if count > k:
        l = mid+1
    else:
        r = mid
print(l) 

Measured memory_bytes: 30964
let pn = 1000000007

let pow x n =
  let rec doit x n acc =
    if n = 0 then acc
    else if n mod 2 = 0 then doit (x * x) (n / 2) acc
    else doit (x * x) (n / 2) (acc * x) in
  doit x n 1

let fold_left f init s n =
  let rec doit i acc =
    if i = n then acc
    else doit (i + 1) (f acc s.[i]) in
  doit 0 init

let () =
  let p = read_line () in
  let t = read_line () in
  let n = String.length p in
  let m = String.length t in
  let h = Array.make (n + 1) 0 in
  String.iteri (fun i c -> h.(i+1) <- h.(i)*pn + Char.code c) p;
  let ht = fold_left (fun acc c -> acc*pn + Char.code c) 0 t m in
  let x = pow pn m in
  for i = m to n do
    if h.(i) - h.(i-m)*x = ht then Printf.printf "%d\n" (i - m);
  done

Measured memory_bytes: 2332
#include <stdio.h> 
int main(){
  int n, debid_money=100000;
  scanf("%d",&n);

  for(int i=1;i<=n;i++){
    debid_money *= 1.05;
    if (debid_money % 1000 >= 1) {
      debid_money = debid_money - (debid_money % 1000) + 1000;
    }
  }

  printf("%d\n", debid_money);
  return 0;   
}


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

string s;

int main(void) {
  // Here your code !
  cin >> s;

  for (int i = 0; i < s.size(); ++i) {
    if (i + 1 < s.size()) {
      if (s[i] == s[i + 1]) {
        printf("%d %d\n", i + 1, i + 1 + 1);
        return 0;
      }
    }

    if (i + 2 < s.size()) {
      if (s[i] == s[i + 2]) {
        printf("%d %d\n", i + 1, i + 1 + 2);
        return 0;
      }
    }
  }
  
  printf("%d %d\n", -1, -1);

  return 0;
}

Measured memory_bytes: 512
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
int n;
bool ok(int y)
{
	int x=n;
	while(x%y==0)
	{
		x/=y;
	}
	return (x%y)==1;
}
int32_t main()
{
	cin>>n;
	set<int> s;
	for(int i=2;i<=sqrt(n);i++)
	{
		if(n%i==0)
		{
			s.insert(i);
			s.insert(n/i);
		}
	}
	set<int> s2;
	for(int i=1;i<=sqrt(n-1);i++)
	{
		if((n-1)%i==0)
		{
			s2.insert((n-1)/i);
			s2.insert(i);
		}
	}
	int ans=0;
	for(auto i:s)
	{
		if(ok(i))ans++;
	}
	cout<<ans+s2.size();
	
}

Measured memory_bytes: 3712
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tl3;



const int BIG_NUM = 1e9;
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;



int main() {
	vector<int> v(5);
	for (int i = 0; i < 5; i++) {
		cin >> v[i];
	}

	sort(v.begin(), v.end());

	int k;
	cin >> k;
	if (abs(v[0] - v[4]) <= k) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}

}


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

typedef long long LL;  
using namespace std;

#define fillchar(a, x) memset(a, x, sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'

const int M = (int)1e9+7;

int main()
{
//ios_base::sync_with_stdio(0); 
	cout.precision(15);
	cout.setf(ios::fixed);

	int a,b,c;

	cin >> a >> b >> c;

	int na,nb,nc;
	int cnt = 0;

	map <pair < pair<int,int> ,int> ,int > mp;

	while(true)
	{
	if(a%2==1 || b%2==1 || c%2==1)
		break;

	cnt++;
	na = (b+c)/2;
	nb = (a+c)/2;
	nc = (a+b)/2;

	a = na;
	b = nb;
	c = nc;

	if(mp[MP(MP(a,b),c)])
	 {cnt = -1;break;}

	 mp[MP(MP(a,b),c)] = true;	

	}
	cout<<cnt<<endl;

}


Measured memory_bytes: 256
n,m = map(int,input().split())

l = []
r = []
for i in range(m):
    tmp_l,tmp_r = map(int,input().split())
    l.append(tmp_l)
    r.append(tmp_r)

ll = l[0]
rr = r[0]

for i in range(1,m):
    if ll < l[i]:
        ll = l[i]
    if rr > r[i]:
        rr = r[i]

cnt = rr-ll+1
if cnt >= 1:
    print(cnt)
else:
    print(0)


Measured memory_bytes: 10996
main = do
  s <- getLine
  print $ solve s
  
solve s
  | s == "SUN" = 7
  | s == "MON" = 6
  | s == "TUE" = 5
  | s == "WED" = 4
  | s == "THU" = 3
  | s == "FRI" = 2
  | s == "SAT" = 1
  | otherwise = -1

Measured memory_bytes: 380
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
		//????????£????????????
		Scanner sc = new  Scanner(System.in);
		//??¨ ?????° ???
		int r = sc.nextInt();
		//??¨ ?????° ???
		int c= sc.nextInt();
		//??¨?????????
		int [][] table = new int [r+1][c+1];
		int i =0;
		int j = 0;
		for(i =0; i<r;i++){
			for(j =0;j<c;j++){
				//??¨?????????????´?
				table[i][j] = sc.nextInt();
			}
		}
		//
		for(i =0;i<r;i++){
			for(j=0;j<c;j++){
				table[i][c] += table[i][j];
				table[r][j] += table[i][j];
				table[r][c]+= table[i][j];
			}
		}
		//??¨?????????
		for(i= 0; i<=r; i++){
			System.out.print(table[i][0]);
			for(j =1;j<=c;j++){
				System.out.print(" " +table[i][j]);
			}
		System.out.println();
		}
	}
}

Measured memory_bytes: 42192
#include <iostream>
#include <vector>

using namespace std;

int main(){
	int A,B,K;
	cin>>A>>B>>K;
	int range = max(A,B);
	vector<int> kobai;
	for(int i=range;i>0;i--){
		if(A%i == 0 && B%i == 0){
			kobai.push_back(i);	
		}
	}
	cout<<kobai.at(K-1);

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
 
using namespace std;
 
int main(){
    int D,N;
    cin>>D>>N;
    int ans=pow(100,D);
    int r=0;
    if(N>=100){
        r=(N-100+1)%100;
    }
    ans=ans*(N+r);
    cout<<ans<<endl;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int N = cin.nextInt();

        string[] S = new string[N];
        int[] P = new int[N];

        for (int i = 0; i < N; ++i)
        {
            S[i] = cin.next();
            P[i] = cin.nextInt();
        }

        int[] Index = new int[N];
        for (int i = 0; i < N; i++)
        {
            Index[i] = i + 1;
        }

        var xy = S.Zip(P, (name, price) => new { name, price }).ToArray();
        var xyz = xy.Zip(Index, (guide, index) => new { guide, index }).ToArray();

        Array.Sort(xyz, (a, b) => {
            if (a.guide.name != b.guide.name) return String.CompareOrdinal(a.guide.name, b.guide.name);
            return -a.guide.price.CompareTo(b.guide.price);
        });

        foreach (var tmp in xyz)
        {
            //WriteLine("{0} {1} {2}", tmp.index, tmp.guide.name, tmp.guide.price);
            WriteLine(tmp.index);
        }
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11476
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int main(){
   int n;
   cin>>n;
   cout<<n*(n+1)/2<<endl;
   return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<int> h(n);
  int ans=0;
  int count=0;
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  reverse(h.begin(),h.end());
  for(int i=1;i<n;i++){
    if(h[i-1]<=h[i]){
      count++;
    }
    else{
      count=0;
    }
    ans=max(ans,count);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3788
#include <iostream>
#include <deque>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    deque<int> deq;
    for(int i=0; i<s.length(); i++) {
        if(s[i]=='B') {
            if(!deq.empty()) deq.pop_back();
        } else {
            deq.push_back((int)(s[i]-'0'));
        }
    }
    for(auto x : deq) cout << x;
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

int main()
{
    cout.precision(18);

    long long N;
    cin >> N;

    cout << (N * N - N - N + N % 2) / 2 << endl;
    for (long long i = 0; i < N; i++)
    {
        for (long long j = i + 1; j < N; j++)
        {
            if (i == j)
                continue;
            else if ((N - 1) - i - N % 2 == j)
                continue;
            else
                cout << i + 1 << ' ' << j + 1 << endl;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  char s[10]={};
  while(scanf("%s",s)!=EOF){
    char ans='d';
    if(s[0]==s[1] && s[1]==s[2] && s[0]!='s')ans=s[0];
    if(s[3]==s[4] && s[4]==s[5] && s[3]!='s')ans=s[3];
    if(s[6]==s[7] && s[7]==s[8] && s[6]!='s')ans=s[7];
    if(s[0]==s[3] && s[3]==s[6] && s[0]!='s')ans=s[0];
    if(s[1]==s[4] && s[4]==s[7] && s[1]!='s')ans=s[1];
    if(s[2]==s[5] && s[5]==s[8] && s[2]!='s')ans=s[2];
    if(s[0]==s[4] && s[4]==s[8] && s[0]!='s')ans=s[0];
    if(s[2]==s[4] && s[4]==s[6] && s[2]!='s')ans=s[2];
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<algorithm>
typedef long long ll;
using namespace std;

int main(){
    int n,k;
    cin >> n;
    string s;
    cin >> s >> k;
    char c;
    c = s[k-1];
    for(int i=0;i<n;i++){
        if(s[i] != c) s[i] = '*';
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<62)-1
#define MAX 1000000000
signed main(){
    int N; cin>>N;
    vi A(N+1),B(N+1);
    int sum=0;
    rep(i,0,N){
        cin>>A[i];
        sum+=A[i];
    }
    rep(i,0,N) cin>>B[i];
    vi C(sum+1);
    int memo=0,cnt=A[0];
    REP(i,1,sum){
        C[i]=min(C[i-1]+1,B[memo]);
        if(i==cnt){
            memo++;
            cnt+=A[memo];
            if(B[memo]<C[i]){
                C[i]=B[memo];
                for(int j=i-1;j>=0;j--){
                    if(C[j]>C[j+1]+1) C[j]=C[j+1]+1;
                    else break;
                }
            }
        }
    }
    double ans=0;
    memo=0;
    cnt=A[0];
    REP(i,1,sum){
        if(C[i-1]<C[i]){
            ans+=C[i-1];
            ans+=0.5;
        }
        else if(C[i-1]==C[i]){
            ans+=C[i];
            if(B[memo]>C[i]) ans+=0.25;
        }
        else{
            ans+=C[i];
            ans+=0.5;
        }
        if(cnt==i){
            memo++;
            if(memo<N) cnt+=A[memo];
        }
    }
    printf("%.10lf\n",ans);
}


Measured memory_bytes: 384
import java.util.*;
 
public class Main{
 
    public static void main(String[] args){
    int Walk,x,y,w,h;
    Scanner in = new Scanner(System.in);
    final int[] dx = {0,1,0,-1}; 
    final int[] dy = {1,0,-1,0};
    int dir;
        
    while(true){
        w = in.nextInt();
        h = in.nextInt();          
 
        if(w+h == 0)break;
        dir = 0;
        x=y=1;
        while(true){
        String op = in.next();
        if(op.equals("STOP"))break;
 
        if(op.equals("RIGHT")){
            ++dir;
            if(dir == 4)dir = 0;
        }
        else if(op.equals("LEFT")){
            --dir;
            if(dir == -1)dir = 3;
        }
        else if(op.equals("FORWARD")){
            Walk = in.nextInt();
            x = x + Walk*dx[dir];
            if(x > w)x = w;
            if(x <= 0)x=1;
            y = y + Walk*dy[dir];
            if(y > h)y = h;
            if(y <= 0)y=1;
        }
        else if(op.equals("BACKWARD")){
            Walk = in.nextInt();
            x = x - Walk*dx[dir];
            if(x > w)x = w;
            else if(x < 0)x = 1;
            y = y - Walk*dy[dir];
            if(y > h)y = h;
            else if(y <= 0)y = 1;
        }
        }
        System.out.println(x + " " + y);
    }
 
    }
 
 
 
}

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

int main()
{
    int n,x;
    cin>> n;
    x=n%10;
    if(x==3)
    cout << "bon";
    else if(x==0 || x==1 || x== 6 || x==8)
    cout << "pon";
    else
    cout << "hon";
    return 0;
}

Measured memory_bytes: 3624
#include"bits/stdc++.h"
using namespace std;
int main(){
	string st;
	cin>>st;
	for(int i=1;;i++){
		st.pop_back();
		if(st.length()%2)continue;
		bool f=false;
		for(int j=0;j*2<st.length();j++){
			if(st[j]!=st[st.length()/2+j]){
				f++;
				break;
			}
		}
		if(!f){
			cout<<st.length()<<endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
    string s;
    cin>>s;
    int x=0,z=0;
    string a={"keyence"};
    for(int i=0;i<=s.size();i++){
        x=0;
        for(int j=0;j<7;j++){
            if(j<i){
                if(s[j]==a[j]) x++;
            }
            else{
                if(s[j+s.size()-7]==a[j]) x++;
            }
        }
        if(x==7){
            z=1;
            break;
        }
    }
    if(z==1) cout<<"YES";
    else cout<<"NO";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int H, W;
    int h, w;
 
    while (1) {
        scanf("%d%d", &H, &W);
        if (H == 0 && W == 0) break;
        for (h = 0; h < H; h++) {
            for (w = 0; w < W; w++) putchar('#');
            putchar('\n');
        }
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 2056
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <numeric>

using namespace std;

typedef long long int ll;
typedef long int li;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main() {
    string ans;
    string s;
    ll lose=0;
    cin >> s;
    ll n = s.length();
    for(ll i=0;i<n;i++){
        if(s.at(i)=='o')lose++;
    }
    if(15-n+lose>=8)ans="YES";
    else ans="NO";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256