akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

typedef long long ll;

map<int,int> decomposition(ll L){
	map<int,int> cnt;
	for(ll i = 2; i*i <= L; i++){
		if(L%i==0){
			while(1){
				if(L%i==0){
					cnt[i]++;
					L/=i;
				}
				else
					break;
			}
		}
	}
	if(L!=1)
		cnt[L]++;
	return cnt;
}

map<int,int> res;

pair<int,int> nums[10001];
pair<int,int> divNum[10001];
int cn;

int ct=0;

void dfs(map<int,int>::iterator cp){
	if(cp==res.end()){
		// ツ仰、ツ津環閉板閉ェツづーツ個按づ淞つスツづァツ、ツ残ツづィツづ個要ツ素ツづ個閉ェツ環づ個陛サツ法ツづ個堕債青板づーツ青板つヲツづゥ
		//vector<int> v;
		set<int> s;
		for(int i = 0; i < cn; i++){
			if(divNum[i].second-nums[i].second>0)
				s.insert(i);
		}
		int mul=(int)pow(2.0,(int)s.size());
		if(mul!=1)
			mul/=2;
		ct+=mul;
	}
	else{
		for(int i = 0; i <= cp->second; i++){
			nums[cn].first=cp->first;
			nums[cn].second=i;
			cn++;
			cp++;
			dfs(cp);
			cp--;
			cn--;
		}
	}
}

int main(){

	ll L;
	while(cin>>L&&L!=0){
		res.clear();
		res=decomposition(L);
		cn=0;
		for(map<int,int>::iterator it = res.begin(); it != res.end(); it++){
			divNum[cn].first=it->first;
			divNum[cn].second=it->second;
			cn++;
		}
		// ツ仰、ツ津環閉板閉ェツづ個個按津ィ
		cn=0;
		ct=0;
		dfs(res.begin());
		cout<<ct<<endl;
	}


	return 0;
}

Measured memory_bytes: 1080
#n=int(input())
n,x,y=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

#adjl=[[0 for i in range(n)] for j in range(n)]

dic={}

for i in range(n):
    for j in range(i,n):
        #if i>=j:
        #    continue
        dis=j-i
        maybe=abs(x-(i+1))+1+abs(y-(j+1))
        dis=min(dis,maybe)
        #adjl[i][j]=dis
        dic[dis]=dic.get(dis,0)+1

for k in range(1,n):
    print(dic.get(k,0))


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

using namespace std;

int main(){
  int a,b,c,k;
  int sum = 0;
  cin>>a>>b>>c>>k;
  if(a!=0)
  {sum+=min(k,a);
  k-=min(k,a);
  }
  if(k!=0 && b!=0)
   k-=min(b,k);
  if(k!=0 && c!=0)
  sum-=min(k,c);
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    int i=0;
    while(true) {
        if(i%2==1) {
            A -= D;
            if(A<=0) {
                cout << "No" << endl;
                break;
            }
        } else {
            C -= B;
            if(C<=0) {
                cout << "Yes" << endl;
                break;
            }
        }
        i++;
    }

    return 0;
}

Measured memory_bytes: 3624
S = input()
T = input()
ans = 0

for i in range(len(S)-(len(T)-1)):
    s = S[i:i+len(T)]
    c = 0
    for j in range(len(T)):
        if s[j] == T[j]:
            c += 1
    ans = max(ans, c)

print(len(T) - ans)


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

using namespace std;
using ll = long long;

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

    int cnt = 0;
    bool flag = false;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        if (a == b) cnt++;
        else cnt = 0;

        if (cnt == 3) flag = true;
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

typedef struct 
{
  char task[10];
  int time;
}t_queue;

t_queue q[100000];

int head = 0;
int tail = 0;

void enqueue(char name[], int time)
{
  strcpy(q[head].task, name);
  q[head].time = time;
  head++;
  if(head > 100000-1) head = 0;
}

t_queue deque(void)
{
  t_queue data;
  data = q[tail];
  tail++;
  if(tail > 100000-1) tail = 0;
  return data;
}

int main(int argc, char const *argv[])
{
  int n, quontime, task_time;
  char task_name[10];
  int total_time = 0;

  scanf(" %d %d",&n,&quontime);

  for(int i = 0; i < n; i++){
    scanf(" %s %d",task_name,&task_time);
    enqueue(task_name, task_time);
  }

  while(head != tail){
    t_queue now_q = deque();
    if(now_q.time - quontime > 0){
      total_time += quontime;
      now_q.time -= quontime;
      enqueue(now_q.task, now_q.time);
    } else {
      total_time += now_q.time;
      printf("%s %d\n", now_q.task, total_time);
    }
  }

  return 0;
}



Measured memory_bytes: 3292
/*+lmake
 * STD = c++14
 * DEFINE += MDEBUG
 */
// failed to generate code

#include <bits/stdc++.h>
using namespace std;

using LL=long long;
#ifdef DEBUG
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

#define MAXN 100
int a[2][MAXN+10];
int main(){	
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=0; i<=1; ++i) {
		for(int j=1; j<=n; ++j) {
			cin>>a[i][j];
		}
	}
	int ans=0;
	for(int k=1; k<=n; ++k) {
		int nans=0;
		for(int i=1; i<=k; ++i) {
			nans+=a[0][i];
		}
		for(int i=k; i<=n; ++i) {
			nans+=a[1][i];
		}
		ans=max(ans,nans);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
package main

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

type BIT [2][]int

func NewBIT(n int) *BIT {
	var b BIT
	for i := range b {
		b[i] = make([]int, n)
	}
	return &b
}

// [l,r)にxを加算
func (b *BIT) add(l, r, x int) {
	add_sub := func(p, idx, x int) {
		for idx < len(b[p]) {
			b[p][idx] += x
			idx += idx & (-idx)
		}
	}
	add_sub(0, l, -x*(l-1))
	add_sub(0, r, x*(r-1))
	add_sub(1, l, x)
	add_sub(1, r, -x)
}

// [l,r)の和
func (b *BIT) sum(l, r int) int {
	sum_sub := func(p, idx int) int {
		s := 0
		for idx > 0 {
			s += b[p][idx]
			idx -= idx & (-idx)
		}
		return s
	}
	return sum_sub(0, r-1) + sum_sub(1, r-1)*(r-1) - (sum_sub(0, l-1) + sum_sub(1, l-1)*(l-1))
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

type Mon struct {
	x, h int
}

type Mons []Mon

func (a Mons) Len() int      { return len(a) }
func (a Mons) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a Mons) Less(i, j int) bool {
	return a[i].x < a[j].x
}

func upperBound(a []int, key int) int {
	l, r := 0, len(a)-1
	for l <= r {
		mid := (l + r) / 2
		if a[mid] <= key {
			l = mid + 1
		} else {
			r = mid - 1
		}
	}
	return l
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n, d, a := nextInt(), nextInt(), nextInt()
	mons := make(Mons, n)
	for i := 0; i < n; i++ {
		x, h := nextInt(), nextInt()
		mons[i] = Mon{x, h}
	}
	sort.Sort(mons)
	x, h := make([]int, n), make([]int, n)
	for i := range mons {
		x[i], h[i] = mons[i].x, mons[i].h
	}

	bit := NewBIT(n + 10)
	for i := 0; i < n; i++ {
		bit.add(i+1, i+2, h[i])
	}

	ans := 0
	for i := 0; i < n; i++ {
		cur := bit.sum(i+1, i+2)
		if cur <= 0 {
			continue
		}
		need := (cur + a - 1) / a
		r := upperBound(x, x[i]+2*d)
		bit.add(i+1, r+1, -need*a)
		ans += need
	}

	puts(ans)
}


Measured memory_bytes: 15500
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        
        while(n != 0){
            double a = 0;
            String input = scanner.nextLine();

            String inputArr[] = input.split(" ");
            double tmp = 0;
            for (int i=0; i<n; i++) {
                tmp += Double.parseDouble(inputArr[i]);
            }
            double average = tmp / n;

            for(int i=0; i<n; i++){
                a += Math.pow(Double.parseDouble(inputArr[i]) - average,2);
            }
            System.out.println( String.format("%.8f",Math.sqrt(a/n)) );
            
            n = Integer.parseInt(scanner.nextLine());
        }
    }
}


Measured memory_bytes: 29608
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64 = int64_t;

int main()
{
    int n;
    cin >> n;
    i64 res = 0;
    for (int i = 0; i <= n; i++) {
        if (i % 3 && i % 5) {
            res += i;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> x >> n;
  vi p(n),b(801);
  REP(i,n){
    cin>>p[i];
    b[p[i]+400]++;
  }

  for(ll i=0;i<102;i++){
    
    if (b[x-i+400]==0){
      ans=x-i;
      break;
    }
    
    if (b[x+i+400]==0){
      ans=x+i;
      break;
    }
    
    
  }




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


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

bool win(vvi v, int n, int x) {
  int r = n + 1, l = 0;
  for (int i = (int)v[0].size() - 1; i >= 0; --i) {
    int nr = n + 1, nl = 0;
    if (v[0][i] == 1) {
      nr = n;
    }
    if (v[0][i] == -1) {
      nl = 1;
    }
    nr = min(nr, r - max(0, v[0][i]) - min(0, v[1][i]));
    nl = max(nl, l - min(0, v[0][i]) - max(0, v[1][i]));
    l = nl, r = nr;
//    cerr << i << ' ' << l << ' ' << r << ' ' << x << endl;
    if (l >= r - 1) break;
  }
  return x <= l || x >= r;
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n, m, l, x0, y0;
  cin >> n >> m >> l >> x0 >> y0;
  vs s(2);
  cin >> s[0] >> s[1];
  vector<vvi> v(2, vvi(2, vi(l)));
  bool fail = false;
  for (int t = 0; t < 2; ++t) {
    for (int i = 0; i < 2; ++i) for (int j = 0; j < l; ++j) {
      if (t == 0 && (s[i][j] == 'U' || s[i][j] == 'D')) {
        v[t][i][j] = s[i][j] == 'U' ? -1 : 1;
      }
      if (t == 1 && (s[i][j] == 'L' || s[i][j] == 'R')) {
        v[t][i][j] = s[i][j] == 'L' ? -1 : 1;
      }
    }
    if (t == 0) {
      if (win(v[t], n, x0)) fail = true;
    } else {
      if (win(v[t], m, y0)) fail = true;
    }
  }
  if (!fail) cout << "YES\n";
  else cout << "NO\n";
  return 0;
}


Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define oo 0x3f3f3f3f

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    cout<<n+n*n+n*n*n;
}


Measured memory_bytes: 3640
#include <stdio.h>

int main()
{
    int n, k, q, a, i;
    int ara[100100]={0};

    scanf("%d %d %d", &n, &k, &q);
    for(i=1; i<=q; i++)
    {
        scanf("%d", &a);
        ara[a]++;
    }
    for(i=1; i<=n; i++)
    {
        if((q-k) < ara[i])
            printf("Yes\n");
        else
            printf("No\n");

    }

    return 0;
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define ld long double
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    ll oddcount=0;
    rep(i,n){
        ll a; cin>>a;
        if(a%2==1) ++oddcount;
    }
    if(oddcount%2==1) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main() {
  int64_t n,i,ans=1;
  double b=0.0;
  cin>>n;
  vector<int64_t> a(n);
  for(i=0;i<n;i++) cin>>a.at(i);
  sort(a.begin(),a.end());
  if (a.at(0)==0) cout<<0<<endl;
  else{
    for(i=0;i<n;i++){
      b+=log(a.at(i))/log(10);
      ans*=a.at(i);
    }
    if(b>18.1) cout<<-1<<endl;
    else if(ans>1000000000000000000) cout<<-1<<endl;
    else cout<<ans<<endl;
  }
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int res = 0;
  for (int i = 0; i < n; ++i) {
    res += s.substr(i, 3) == string("ABC");
  }
  cout << res << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)

const ll MOD = 1e9 + 7;

struct Point {
    int x;
    int y;
};

void solve(istream& cin, ostream& cout) {
  int h, w;
  int b_num = 0;
  cin >> h >> w;
  queue<Point> p;
  vector<vector<int>> a(h, vector<int>(w));
  REP(i, h) {
    string s;
    cin >> s;
    REP(j, w) {
      if (s[j] == '#') {
        b_num++;
        a[i][j] = 1;
        p.push({i, j});
      } else {
        a[i][j] = 0;
      }
    }
  }

  int ans = 0;
  while (b_num < h * w) {
    queue<Point> q;
    swap(p ,q);
    while (q.size()) {
      int x = q.front().x;
      int y = q.front().y;
      q.pop();
      if (x > 0) {
        if (a[x - 1][y] == 0) {
          a[x - 1][y] = 1;
          p.push({x - 1, y});
          b_num++;
        }
      }
      if (y > 0) {
        if (a[x][y - 1] == 0) {
          a[x][y - 1] = 1;
          p.push({x, y - 1});
          b_num++;
        }
      }
      if (x < h - 1) {
        if (a[x + 1][y] == 0) {
          a[x + 1][y] = 1;
          p.push({x + 1, y});
          b_num++;
        }
      }
      if (y < w - 1) {
        if (a[x][y + 1] == 0) {
          a[x][y + 1] = 1;
          p.push({x, y + 1});
          b_num++;
        }
      }
    }
    ans++;
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  solve(cin, cout);
}
#endif


Measured memory_bytes: 12432
#include <iostream>
using namespace std;
int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a>b&&a>c){
		cout << b+c << endl;
	}else if(b>a&&b>c){
		cout << a+c << endl;
	}else{
		cout << a+b << endl;
	}
	return 0;
	}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int dfs(int node, vector<vector<int>> &edge){
    
    priority_queue<int,vector<int>,greater<int>> que;
    for(auto x:edge[node]){
        que.push(dfs(x, edge));
    }

    int n=edge[node].size();
    int d=0;
    while((int)que.size()){
        d=max(d,que.top()+n);
        que.pop();
        n--;
    }

    return d;
}

int main(){
    int N;
    cin >> N;
    vector<vector<int>> edge(N,vector<int>(0));
    for(int i=1; i<N; i++){
        int a;
        cin >> a;
        a--;
        edge[a].push_back(i);
    }

    cout << dfs(0, edge) << endl;;
}

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

void Main() {
  int A, B;
  cin >> A >> B;
  cout << A * B << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> vector<T> make_vec(size_t n) { return vector<T>(n); }
template<typename T, typename... Args> auto make_vec(size_t n, Args... args) {
    return vector<decltype(make_vec<T>(args...))>(n, make_vec<T>(args...));
}
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value>::type fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<!is_same<T, U>::value>::type fill_v(U& u, const V... v) {
    for (auto& e : u) fill_v<T>(e, v...);
}

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    ll yen = 1000;
    rep(i, n-1) {
        if (a[i] < a[i+1]) {
            ll tmp = yen / a[i];
            yen -= tmp * a[i];
            yen += tmp * a[i+1];
        }
    }
    cout << yen << '\n';
}


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

typedef long long ll;
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
 
using namespace std;

int main(){
    
    string s;
    int w;
    cin >> s >> w;
    int a = s.length();
    int x = 0;
    while(x < a){
        cout << s[x];
        x += w;
    }
}


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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

int H,W,N;

int main()
{
    cin >> H >> W >>  N;
    int k = max(H,W);

    cout << (N%k == 0 ? N/k:N/k+1) <<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	n%=10;
	if(n==3)
	    cout<<"bon"<<endl;
	else if(n==2||n==4||n==5||n==7||n==9)
	    cout<<"hon"<<endl;    
	else
	    cout<<"pon"<<endl;
	return 0;
}

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

template<int MOD>
class mod_int {
	unsigned x;
public:
	mod_int() : x(0) { }
	mod_int(int sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	mod_int(long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	int get() const { return (int)x; }

	mod_int &operator+=(mod_int that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
	mod_int &operator-=(mod_int that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
	mod_int &operator*=(mod_int that) { x = (unsigned long long)x * that.x % MOD; return *this; }
	mod_int &operator/=(mod_int that) { return *this *= that.inverse(); }

	mod_int operator+(mod_int that) const { return mod_int(*this) += that; }
	mod_int operator-(mod_int that) const { return mod_int(*this) -= that; }
	mod_int operator*(mod_int that) const { return mod_int(*this) *= that; }
	mod_int operator/(mod_int that) const { return mod_int(*this) /= that; }

	bool operator==(const mod_int& that) const { return x == that.x; }

	mod_int inverse() const {
		long long a = x, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		return mod_int(u);
	}
};

template<int MOD>
istream& operator >> (istream& is, mod_int<MOD>& val) {
	long long x;
	is >> x; val = x;
	return is;
}

template<int MOD>
ostream& operator << (ostream& os, const mod_int<MOD>& val) {
	os << val.get();
	return os;
}

const int mod = 1e9 + 7;
using mint = mod_int<mod>;

const int MAX = 1e5;

mint dp[MAX + 1][4];

int main()
{
	string S;
	cin >> S;
	int n = S.size();
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		if (S[i] == '?') {
			for (int c = 0; c < 4; c++) {
				dp[i + 1][c] = dp[i][c] * 3;
			}
			for (int c = 0; c < 3; c++) {
				dp[i + 1][c + 1] += dp[i][c];
			}
		}
		else {
			for (int c = 0; c < 4; c++) {
				dp[i + 1][c] = dp[i][c];
			}
			int c = S[i] - 'A';
			dp[i + 1][c + 1] += dp[i][c];
		}
	}
	cout << dp[n][3] << endl;
	return 0;
}


Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var s = GetIntArray();
            var ans = (s[0] - 1) * (s[1] - 1);

            Console.Write(ans);
        }



        static public string GetStr() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 13396
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct node{int p,l,r;};
struct node t[MAX];
int n;

void preparse(int);
void inparse(int);
void postparse(int);

int main(){
  int i,v,l,r,root;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    t[i].p=NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    t[v].l=l;
    t[v].r=r;
    if(l!=NIL) t[l].p=v;
    if(r!=NIL) t[r].p=v;
  }

  for(i=0;i<n;i++) if(t[i].p==NIL) root=i;

  printf("Preorder\n");

  preparse(root);
  printf("\n");
  printf("Inorder\n");
  inparse(root);
  printf("\n");
  printf("Postorder\n");
  postparse(root);
  printf("\n");
  return 0;
}

void preparse(int u){
  if(u==NIL) return;
  printf(" %d",u);
  preparse(t[u].l);
  preparse(t[u].r);
}

void inparse(int u){
  if(u==NIL) return;
  inparse(t[u].l);
  printf(" %d",u);
  inparse(t[u].r);
}

void postparse(int u){
  if(u==NIL) return;
  postparse(t[u].l);
  postparse(t[u].r);
  printf(" %d",u);
}



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

MAX = max(A)

# remap
AR = [0] * (MAX+1)
V = [False] * (MAX+1)
for i in range(N): AR[A[i]] += 1
pairwise, setwise = True, True

# sieve
for i in range(2, MAX+1):
    if V[i]: continue
    cnt, j = 0, i
    while j < MAX+1:
        cnt += AR[j]
        V[j] = True
        j += i
    if cnt > 1: pairwise = False
    if cnt == len(A): setwise = False

if pairwise:
    print('pairwise coprime')
elif setwise:
    print('setwise coprime')
else:
    print('not coprime')


Measured memory_bytes: 196992
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    ll n;
    cin >> n;
    ll ans = n - 1;
    for(int i = 2; i <= sqrt(n); i++){
        if(n % i == 0){
            ans = min(ans, (i - 1) + (n/i - 1));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import collections
n = int(input())
s = [input() for _ in range(n)]
c = collections.Counter(s)
c = c.most_common()
base = c[0][1]
ans = []
for i in range(len(c)):
    if (c[i][1]==base):
        ans.append(c[i][0])
    else:
        break
ans.sort()
print(*ans, sep="\n")


Measured memory_bytes: 45036
let input = require('fs').readFileSync( '/dev/stdin', 'utf8' );
let arr = input.split("\n");
for (let i = 0; i < arr.length; i ++) {
    let lineArr = arr[i].split(" ");
    let a = lineArr[0] - 0;
    let op = lineArr[1];
    let b = lineArr[2] - 0;
    let res = 0;
    if (op === '?') break;
    if (op === '+') res = a + b;
    else if (op === '-') res = a - b;
    else if (op === '*') res = a * b;
    else if (op === '/') res = Math.floor(a / b);
    console.log(res);
}


Measured memory_bytes: 15404
N, K = map(int, input().split())
A = list(map(int, input().split()))

from itertools import combinations as com

folds = com(range(N), K)
ans = float('inf')
for fold in folds:
    B = A[:]
    tmp = 0
    for i in range(1, K):
        if B[fold[i]] <= B[fold[i-1]]:
            diff = B[fold[i-1]] - B[fold[i]] + 1
            tmp += diff
            B[fold[i]] += diff

    k = 1
    border = B[0]
    for i in range(1, N):
        if border < B[i]:
            k += 1
            border = B[i]

    if k >= K:
        ans = min(ans, tmp)

print(ans)


Measured memory_bytes: 71424
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 res = 0;
		for (int i=A; i<=B; i++) {
			int l1 = i%10; int l2 = i/10000%10;
			int f1 = i/10%10; int f2 = i/1000%10;
			if ( l1 == l2 && f1 == f2) res ++;
		}
		System.out.println(res);
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,i,a[666],sum;
int main(){
	cin>>n;
    for(i=1; i<=n; i++){
    	cin>>a[i];
        sum+=a[i];
    }
    cin>>m;
    while(m--){
        int p,x;
        scanf("%d%d",&p,&x);
        printf("%d\n",sum-a[p]+x);
    }
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(vs) (ll)(vs.size())
#define rep(i,a,b) for (ll i=a;i<b;++i)
#define rep_(i,a,b) for (ll i=a;i>b;--i)
#define iter(i,c) for (auto i:c)
#define endl '\n'
const ll mod = 1e9 + 7;

const ll maxn = 100;

ll n;
ll a[maxn];

void solve() {
	cin>>n;
	a[0] = 300;
	rep(i,1,n + 1) cin>>a[i];
	ll buy[100] = {};
	buy[n+1] = 1;
	vi buy_;
	rep(i, 1, n + 1) if (a[i]<=a[i-1]) {buy[i] = 1;buy_.pb(i);}
	buy_.pb(n+1);
	rep(i, 0, sz(buy_)) {
		buy[buy_[i]-1] -= 1;
	}
	ll money = 1000;
	ll stocks = 0;
	rep(i,1,n+1) {
		if (buy[i]==1) {
			stocks = money/a[i];
			money %= a[i];
		}
		if (buy[i]==-1) {
			money += stocks * a[i];
			stocks = 0;
		}
	}
	cout<<money;
}

void aux() {
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cout<<fixed<<setprecision(10);
	aux();
	ll _ = 1;
	// cin>>_;
	while(_--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3648
import java.io.File;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Map.Entry;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		String S = sc.next();
		long count = 0;
		int index = 0;
		char c = S.charAt(0);
		boolean end = false;
		while(true){
			while(S.charAt(index) == c){
				index++;
				if(index == S.length()){
					end = true;
					break;
				}
			}
			if(end) break;
			count++;
			c = S.charAt(index);
		}
		System.out.println(count);
	}
}

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}

Measured memory_bytes: 22100
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <climits>
#include <cstring>
#include <functional>

using namespace std;

using ll = long long;

#define rep(i, N) for(int i = 0;i < N;i++)
#define LARGE INT_MAX / 2

string N;

int f(int i) {
	int sum = 0;
	rep(j, i) {
		sum += N[j] - '0';
	}
	sum += N[i] - '0' - 1;
	sum += 9 * (N.length() - i - 1);
	return sum;
}

int main() {
	cin >> N;
	int ans = 0;
	int all = 0;
	rep(i, N.length()) {
		ans = max(ans, f(i));
		all += N[i] - '0';
	}
	cout << max(ans, all) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef dbg
#include "./printer.hpp"
#else
#define dump(x) (void)0
#endif


using namespace std;

inline long  toInt(string s) {long  v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define long long long
long  pw(long  x, long  y){long  ans = 1;for(long  i = 0; i < y; i++){ans = ans * x;}return ans;}
long  factorial(long  x){long  ans = 1; for(int i = 1 ;i < x+1; i++){ans = ans *i;}return ans;}

long  permutation(long  x, long  y){return factorial(x)/factorial(x-y);}

//long combination(long x, long y){long ans = 1;if(y == 0){return 1;}	if(x-y < y){return combination(x,x-y);}for(long i = 0; i < y; i++){	ans *= (x-i);}	for(long i = 0; i < y; i++){ans /= (i+1);	}

#define MOD 1000000007
#define INF 1000000000000

template<class T1, class T2>
long Min(T1 a, T2 b){
    return (a > b ? b : a);
}
template<class T1, class T2>
long Max(T1 a, T2 b){
    return (a < b ? b : a);
}

int main(){

  string s[3];
  cin >> s[0] >> s[1] >> s[2];
 
  int ind[3] = {0};
  int cur = 0;
  int temp = -1;
  while(1){


    
      if(ind[cur] == s[cur].length()){
	break;
      }

       temp = cur;


    if(s[cur][ind[cur]] == 'a'){
      cur = 0;
    }else if(s[cur][ind[cur]] == 'b'){
      cur = 1;
    }else if(s[cur][ind[cur]] == 'c'){
      cur = 2;
				 
    }

    ind[temp]++;


    
    dump(cur);
    
  }
  if(cur == 0){
    cout << "A" << endl;
    return 0;
  }else if (cur == 1){
    cout << "B" << endl;
    return 0;
  }else{
    cout << "C" << endl;
    return 0;
  }

}


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

int main()
{
	bool isOK = true;
	
	vector<int> vec(5);
	for (int i = 0; i < 5; i++)
	{
		cin >> vec.at(i);
	}

	int k;
	cin >> k;

	for (int i = 0; i < 5; i++)
	{
		for (int j = 0; j < 5; j++)
		{
			if (k < vec.at(j) - vec.at(i))
			{
				isOK = false;
				break;
			}
		}
	}

	if (isOK)
	{
		cout << "Yay!" << endl;
	}
	else
	{
		cout << ":(" << endl;
	}
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;

#ifndef LOCAL
#pragma GCC optimize ("O2")
#define endl '\n'
#endif

template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

ll pwr(ll a,ll b, ll mod){
    a %= mod;
    int ans = 1;
    while(b){
        if(b & 1) ans = (ans * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return ans;
}

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int N = 105;
int dp[3][N], a[3][N];
void solve(){
	int n;
	cin >> n;
	fr(j, 1, 2)
	fr(i, 1, n){
		cin >> a[j][i];
	}
	fr(i, 1, n){
		dp[1][i] = dp[1][i - 1] + a[1][i];
	}
	fr(i, 1, n){
		dp[2][i] = max(dp[2][i - 1], dp[1][i]) + a[2][i];
	}
	cout << dp[2][n];
}
signed main(){
    IO;
    #ifdef LOCAL
        freopen("inp.txt","r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    cout << setprecision(10) << fixed;
    int t = 1;
    // cin >> t;
    fr(tt, 1, t){
        solve();
    }
    return 0;
}

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

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)

int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  string S; cin >> S;
  int k = 0;
  int i = 0;
  int prevLen = 2;
  while (i < (int)S.size()) {
    if (i+2 == (int)S.size() && S.at(i) == S.at(i+1)) {
      k += 1;
      i += 2;
    } else if (prevLen > 1) {
      k += 1;
      i += 1;
      prevLen = 1;
    }else if (i+4 == (int)S.size() &&
	      S.at(i-1) == S.at(i) &&
	      S.at(i) == S.at(i+1) &&
	      S.at(i+1) == S.at(i+2) &&
	      S.at(i+2) == S.at(i+3)) {
      k += 2;
      i += 4;
    }else if (S.at(i-1) == S.at(i)) {
      k += 1;
      i += 2;
      prevLen = 2;
    }else {
      k += 1;
      i += 1;
      prevLen = 1;
    }
  }

  cout << k << endl;

  return 0;
}



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

vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
int h, w, k;

void bfs(vector<vector<char>> &a, int si, int sj, vector<vector<int>> &x) {
  x.at(si).at(sj) = 0;
  queue<pair<int, int>> q;
  q.push(make_pair(si, sj));
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop();
    for (int i = 0; i < 4; i++) {
      int ni = p.first + dx[i], nj = p.second + dy[i];
      if (0 <= ni && ni < h && 0 <= nj && nj < w) {
        if (a.at(ni).at(nj) == '.' && x.at(ni).at(nj) == -1) {
          x.at(ni).at(nj) = x.at(p.first).at(p.second) + 1;
          q.push(make_pair(ni, nj));
        }
      }
    }
  }
  return;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  cin >> h >> w >> k;
  
  vector<vector<char>> a(h, vector<char>(w));
  int si, sj;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> a.at(i).at(j);
      if (a.at(i).at(j) == 'S') {
        si = i;
        sj = j;
        a.at(i).at(j) = '.';
      }
    }
  }
  
  vector<vector<int>> x(h, vector<int>(w, -1));
  bfs(a, si, sj, x);
  
  int ans = 1e9;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (0 <= x.at(i).at(j) && x.at(i).at(j) <= k) {
        int keep = min({(i + k - 1) / k, (h - i - 1 + k - 1) / k, (j + k - 1) / k, (w - j - 1 + k - 1) / k});
        ans = min(ans, keep + 1);
      }
    }
  }
  
  cout << ans << '\n';
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
#define REP(i, a, b) for (int i=a; i<b; i++)

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

int die1[N], die2[N];
for(int i = 0 ; i < N ; i++)
{
    cin >> die1[i];
    cin >> die2[i];
} 

int cnt = 0;
bool flag = false;
for(int i = 0 ; i < N ; i++)
{
    if(die1[i] == die2[i])
    {
        cnt++;
    }
    else{
        cnt = 0;
    }

    if(cnt == 3)
    {
        flag = true;
    }

}

if(flag)
cout << "Yes";
else
{
    cout << "No";
}


}

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

int main(){
int max_s=0,cnt=0;
string s;
cin >> s;
for (int i = 0;i < s.size();i++){
    if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
        cnt ++;
        if(cnt > max_s){
            max_s=cnt;
    }
    }
    else{
            cnt=0;
        }
    
}
cout << max_s << endl;

}

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

using namespace std;

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

    vector<vector<long long>> dp(n, vector<long long>(2));

    dp[0][0] = a[0];
    dp[0][1] = -1e12;

    for(int i = 1; i < n; i++){
        dp[i][0] = a[i] + max(dp[i-1][0], dp[i-1][1]);
        dp[i][1] = -a[i] + max(dp[i-1][0] - 2*a[i-1], dp[i-1][1] + 2*a[i-1]);
    }

    cout << max(dp[n-1][0], dp[n-1][1]) << endl;
    return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;

  int key;
  map<int, int> tests;
  for(int i=0;i<N;i++){
    cin >> key;
    tests[key] = 1;
  }

  string result;
  if(tests.size() == N){
    result = "YES";
  } else {
    result = "NO";
  }

  cout << result << endl;

}

Measured memory_bytes: 9600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
using namespace std;

int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int sum = 0;

   if(k - a > 0){
       sum = sum + a;
       k = k - a;
       if(k - b > 0){
           k = k - b;
           printf("%d\n", sum - k);
       }
       else{
           printf("%d\n", a);
       }

   }
   else{
       printf("%d\n", k);
   }

   return 0;
}

Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 100001
ll n,A[M],res,H[M];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>A[i];
	for(int i=2;i<=n;i+=2)res+=A[i]-A[i-1];
	H[1]=A[n]-res;
	for(int i=3;i<=n;i+=2)H[i]=H[i-2]+(A[i-1]-A[i-2])*2;
	for(int i=2;i<=n;i+=2)H[i]=A[i-1]*2-H[i-1];
	for(int i=1;i<=n;i++)printf("%lld ",H[i]);
	return 0;
}

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


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

    int N, X, Y;
    cin >> N >> X >> Y;
    cout << min(X, Y) << " " << max(0, X+Y-N) << endl;
}


Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0
inf = float("inf")

N = k()
A = l()

for i in A:
    if i % 2 == 1:
        ans += 1

if ans % 2 == 0:
    print("YES")
else:
    print("NO")


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

typedef long long int ll;
ll powk(ll a, ll n = 2){
    ll r = 1;
    for(ll i = 0;i < n;i++){
        r *= a;
    }

    return r;
}


int main()
{
    ll x, k, d;
    cin >> x >> k >> d;

    ll ans;
    if(abs(x / d) <= k){
        if(abs(x / d) % 2 == k % 2){
            ans = abs(x % d);
        }
        else{
            ans = abs(x % d);
            ans = min(abs(ans + d), abs(ans - d));
        }
    }
    else{
        if(x > 0){
            ans = abs(x - d * k);
        }
        else{
            ans = abs(x + d * k);
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 3632
#include <map>
#include <vector>
#include <iostream>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


long long X, Y;

int main() {
  while (cin >> X >> Y) {
	int res = 0;
	while (true) {
	  ++res;
	  X *= 2;
	  if (Y < X) break;
	}
	cout << res << endl;
  }
}
















Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
b = 1
c = 0
d = 10 ** 18
e = a.include?(0)

if e
  b = 0
else
  a.each do |k|
    b = b * k
    if b > d
      c = 1
      break 
    end
  end
end


puts c == 1 ? '-1' : b

Measured memory_bytes: 23488
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int n;
    double sum=0, ave, ssum=0, ans;
    
    while(1){
        sum = 0;
        ssum = 0;
        cin >> n;
        if(n==0){
            break;
        }
        double s[n];
        for(int i=0;i<n;i++){
            cin >> s[i];
            sum += s[i];
        }
        
        ave = sum / double(n);
        
        for(int i=0;i<n;i++){
            ssum += (s[i]-ave)*(s[i]-ave);
        }
        
        ans = sqrt(ssum/double(n));
        cout << ans << endl;
        
    }
    
    
    return 0;
}


Measured memory_bytes: 3240