akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(void){
    int n,x,y;
    int i,j,p;
    int option[3];
    vector<int> route;
    cin >> n >> x >> y;
    for(i=0;i<n-1;i++){
        route.push_back(0);
    }
    for(i=1;i<n;i++){
        for(j=0;j<3;j++){
            option[j]=0;
        }
        for(j=i+1;j<=n;j++){
            option[0] = j-i;
            option[1] = abs(x-i)+abs(y-j)+1;
            option[2] = abs(y-i)+abs(x-j)+1;
            p=min(option[0],option[1]);
            p=min(p,option[2]);
            route[p-1]++;
        }
    }
    for(i=0;i<n-1;i++){
        cout<<route[i]<<"\n";
    }
    return 0;
}

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

int main(){
    int K; cin >> K;
    vector<int> A = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    cout << A[K-1] << endl;
}

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

using namespace std;

const int INF = 1e9;

int n, m;
int dist[1005], from[1005];
vector <int> edge[1005];
vector <int> sol;
int res;

void bfs(int s) {
	for (int i = 1; i <= n; i++) dist[i] = INF;
	dist[s] = 0;
	from[s] = -1;
	queue <int> que;
	que.push(s);
	
	while (que.size()) {
		int now = que.front();
		que.pop();
		
		for (int i = 0; i < edge[now].size(); i++) {
			int to = edge[now][i];
			if (dist[to] != INF) continue;
			dist[to] = dist[now] + 1;
			from[to] = now;
			que.push(to);
		}
	}
}

int main() {
	scanf("%d%d", &n, &m);
	
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		edge[x].push_back(y);
	}
	
	//find the minimum cycle
	
	res = INF;
	
	for (int i = 1; i <= n; i++) {
		bfs(i);
		int mn = INF;
		int idx = -1;
		
		for (int j = 1; j <= n; j++) {
			if (i == j) continue;
			for (int k = 0; k < edge[j].size(); k++) {
				int to = edge[j][k];
				if (to == i && dist[j] + 1 < mn) {
					mn = dist[j] + 1;
					idx = j;
					break;
				}
			}
		}
		
		if (mn < res) {
			res = mn;
			sol.clear();
			int cur = idx;
			while (cur != -1) {
				sol.push_back(cur);
				cur = from[cur];
			}
		}
	}
	
	if (res == INF) printf("-1\n");
	else {
		printf("%d\n", sol.size());
		for (int i = 0; i < sol.size(); i++) {
			printf("%d\n", sol[i]);
		}
	}
}


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

int main(){
  string s;ll k;cin >> s >> k;
  rep(i,k)if(s[i] != '1'){cout << s[i] << endl;return 0;}
  cout << "1" << endl;
  return 0;
}

Measured memory_bytes: 256
class Combination:
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv


s = int(input())
mod = 10**9 + 7
comb = Combination(100000)
ans = 0

for i in range(1, s//3+1):
    ans += comb(s-3*i+i-1, s-3*i)
    ans %= mod

print(ans)






Measured memory_bytes: 20780
#include<iostream>
#include<cstring>
using namespace std;
int const N = 1001;
int main(){
  char str[N][50];
  int num[N],i=0,max=0,l=0;
  while(cin >> str[i]){
    i++;
  }
  for(int j =0;j<i;j++){
    num[j] =0;
  }
  for(int j=0;j<i;j++){
    for(int k=0;k<i;k++){
       if(strcmp(str[j],str[k]) == 0)
	num[j]++;
    }
    if(num[max] < num[j])
      max = j;
    if(strlen(str[l]) < strlen(str[j]))
      l = j;
  }
  cout <<  str[max] <<" "<< str[l] << endl;
}
  
  

Measured memory_bytes: 0
s=input()
def result(limit):
    if limit%2==1:return 'First'
    if limit%2==0:return 'Second'
first=s[0]
last=s[-1]
if first!=last:
    first_idx=[]
    last_idx=[]
    for x in range(s.count(first)):
        first_idx.append(s.index(first,x))
    for y in range(s.count(last)):
        last_idx.append(s.index(last,y))
    judge=0
    data=[]
    data.append(last_idx.pop())
    while judge<2:
        if judge==0:
            while judge==0:
                if len(first_idx)==0:judge=2
                else:
                    k=first_idx.pop()
                    if k<data[-1]:
                        judge=1
                        data.append(k)
                    
        elif judge==1:
            while judge==1:
                if len(last_idx)==0:judge=2
                else:
                    k=last_idx.pop()
                    if k<data[-1]:
                        judge=0
                        data.append(k)
        
    print(result(len(s)-len(data)))

elif first==last:
    first_idx=[]
    for x in range(s.count(first)):
        first_idx.append(s.index(first,x))
    
    alpha='abcdefghijklmnopqrstuvwxyz'
    counter=[0 for _ in range(len(alpha))]
    for i in range(1,len(first_idx)):
        string=s[first_idx[i-1]+1:first_idx[i]]
        for j in range(len(alpha)):
            if alpha[j] in string:counter[j]+=1
    k = max(counter)
    print(result(len(s)-2*k-1))

Measured memory_bytes: 7412
import           Control.Monad
import qualified Data.Array.IO               as IO
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

main = do
  [h, w, k] <- getIntList
  ss <- replicateM h BS.getLine

  let splitLine i mode n s res
        | i == w                            = (res, n)
        | mode < 0 && s `BS.index` i == '#' = splitLine (i+1) 1     (n+1) s (replicate (i+1) (n+1))
        | mode < 0                          = splitLine (i+1) mode  n     s []
        |             s `BS.index` i == '#' = splitLine (i+1) mode  (n+1) s (res ++ [n+1])
        | otherwise                         = splitLine (i+1) mode  n     s (res ++ [n])

      solve []      _ = []
      solve (s:ss') n = let (res, n') = splitLine 0 (-1) n s []
                        in res : solve ss' n'

      t = solve ss 0

      res i d | i < 0         = []
              | i >= length t = []
              | null (t !! i) = res (i+d) d
              | otherwise     = t !! i

  forM_ [0..(length t - 1)] $ \i -> do
    let t = res i 1
        t' = if null t then res i (-1) else t
    putStrLn $ foldl' (\s i -> s ++ " " ++ show i) (show $ head t') (tail t')

Measured memory_bytes: 13180
d[4],e[9],f,k;
char s[30];
f2(){
	int a,b,c;
	a=e[f++];
	a>9?s[k++]=40,
		b=f2(),
		s[k++]=a,
		c=f2(),
		s[k++]=41,
		a=a-43?a-45?b*c:b-c:b+c:
		(s[k++]=a+48);
	return a;
}
f1(o,n,i){
	int j;
	if(i==7){
		f=k=0;
		if(f2()==10){
			s[k]=0;
			puts(s);
			return 1;
		}
		return 0;
	}
	if(o){
		for(j=0;j<3;j++){
			e[i] = "+-*"[j];
			if(f1(o-1,n+1,i+1))return 1;
		}
	}
	if(n||i==6){
		for(j=0;j<4;j++){
			if(e[i]=d[j]){
				d[j]=0;
				if(f1(o,n-1,i+1))return 1;
				d[j]=e[i];
			}
		}
	}
	return 0;
}

int main(void){
	for(;scanf("%d%d%d%d",d,d+1,d+2,d+3),f=*d;)
		f1(3,0,0)||puts("0");
}

Measured memory_bytes: 0
#coding:utf-8
n = int(input())
s = list(map(str, input().split()))

#すでに中身はPWGかPWGYのどちらかであると分かっているので、Yの数のみで場合分け
if s.count('Y') >= 1:
    print('Four')
else:
    print('Three')

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

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

ll INF = 1e10;
vector<int> v(100110);
vector<ll> dp(100110, INF);

int main(){
    int N, K;
    cin >> N >> K;
      
    rep(i, N) cin >> v[i];
    
    dp[0] = 0;
    rep(i, N){
        rep2(j, 1, K+1){ 
            chmin(dp[i+j], dp[i] + abs(v[i] - v[i+j]));
        }
    }
    
    cout << dp[N-1] << endl;
    return 0;
}


Measured memory_bytes: 4584
#[allow(unused_imports)]
use std::cmp;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use proconio::derive_readable;
use proconio::fastout;
#[allow(unused_imports)]
use num::Integer;
#[allow(unused_imports)]
use itertools::Itertools;

#[fastout]
fn main() {
  input! {
    n: usize,
    m: usize,
    s: usize,
    rail: [(Usize1, Usize1, usize, i64); m],
    ex: [(usize, i64); n],
  }
  let mut edge = vec![vec![]; n];
  for (u, v, a, b) in rail.into_iter() {
    edge[u].push((v, a, b));
    edge[v].push((u, a, b));
  }
  use std::cmp::Reverse;
  use std::collections::BinaryHeap;
  // time, place, silver
  let mut q: BinaryHeap<(Reverse<i64>, usize, usize)> = BinaryHeap::new();
  let max_s = 50 * m * 2;
  let s = cmp::min(s, max_s);
  q.push((Reverse(0), 0, s));
  let mut time = vec![vec![1i64 << 60; max_s + 1]; n];
  time[0][s] = 0;
  let next = |i: usize, x: usize, now: i64, add: i64, q: &mut BinaryHeap<_>, time: &mut Vec<Vec<i64>>| {
    if now + add < time[i][x] {
      time[i][x] = now + add;
      q.push((
        Reverse(time[i][x]),
        i,
        x
      ));
    }
  };
  while let Some((Reverse(t), i, x)) = q.pop() {
    next(i, cmp::min(x + ex[i].0, max_s), t, ex[i].1, &mut q, &mut time);
    for &(j, a, b) in &edge[i] {
      if let Some(y) = x.checked_sub(a) {
        next(j, y, t, b, &mut q, &mut time);
      }
    }
  }
  for i in 1 .. n {
    println!("{}", time[i].iter().min().unwrap());
  }
}


Measured memory_bytes: 12356
'use strict'

const gcd = (a, b)  => {
  return b ? gcd(b, a % b) : a
}

const lcm = (a, b) => {
  return a * b / gcd(a, b);
}

const main = input => {
  const args = input.split(' ')
  const numA = parseInt(args[0])
  const numB = parseInt(args[1])
  
  console.log(lcm(numA, numB)) 
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<iostream>
#include<algorithm>

using namespace std;

int selectionSort(int A[], int N) {
	int i, j, t, sw = 0, minj;
	for (i = 0;i < N - 1;i++) {
		minj = i;
		for (j = i;j < N;j++) {
			if (A[j] < A[minj])minj = j;
		}
		swap(A[i], A[minj]);
		if (i != minj)sw++;
	}
	return sw;
}

int main() {
	int N;
	cin >> N;
	int a[114514];
	int i, j;
	for (i = 0;i < N;i++) {
		cin >> a[i];
	}
	int sw = selectionSort(a, N);
	for (int i = 0;i < N;i++) {
		if (i)cout << " ";
		cout << a[i];
	}
	
	cout << endl;
	cout << sw << endl;
	return 0;
}


Measured memory_bytes: 3100
n = int(input().rstrip())
edgeList = [int(x) for x in input().rstrip().split(" ")]
cnt = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    if edgeList[i] != edgeList[j]:
      for k in range(j+1, n):
        cnt += (edgeList[i] != edgeList[k] and 
                edgeList[j] != edgeList[k] and 
                edgeList[i] + edgeList[j] > edgeList[k] and 
                edgeList[j] + edgeList[k] > edgeList[i] and 
                edgeList[k] + edgeList[i] > edgeList[j])
print(cnt)

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

int main() {
	int n;
	cin>>n;
	string array[n];
	string array2[n];
	for(int i=0;i<n;i++){
	    cin>>array[i];
	    array2[i]=array[i];
	}
	int flag=0;
	sort(array2,array2+n);
	for(int i=0;i<n-1;i++){
	    if(array2[i]==array2[i+1]){
	        flag=1;
	        goto end;
	    }
	}
	for(int j=0;j<n-1;j++){
	    if(array[j].at(array[j].length()-1)!=array[j+1].at(0)){
	        flag=1;
	        break;
	    }
	    
	}
	end:
	if(flag==1){
	    cout<<"No";
	}
	else{
	    cout<<"Yes";
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	char date[20] = "yyyy/mm/dd";
	scanf("%s", date);
	
	date[0] = '2';
	date[1] = '0';
	date[2] = '1';
	date[3] = '8';
	
	printf("%s", date);
	return 0;
}

Measured memory_bytes: 1696
import sys
input = sys.stdin.readline
import numpy as np

N, W = map(int, input().split())

dp = np.zeros([N+1,W+1],dtype=int)

# 重かったので却下
# for i in range(N):
#     weight,value = map(int, input().split())
#     for sum_w in range(W+1):
#         if sum_w - weight >=  0:
#             dp[i+1][sum_w] = max(dp[i][sum_w], dp[i][sum_w - weight] + value)
#         dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])

for i in range(N):
    weight, value = map(int, input().split())
    dp[i+1] = dp[i]
    dp[i+1, weight:] = np.maximum(dp[i+1, weight:], dp[i, :W-weight+1] + value)

print(dp[N][W])


Measured memory_bytes: 92448
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;


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

	int a, b;
	string s;
	cin >> a >> b >> s;

	if(a+b+1 != s.size()){
		cout << "No"<< endl;
	}else{
		bool ans = true;
		int i = 0;
		int n = s.size();
		for(; i < a; i++){
			if(s[i]=='-')ans = false;
		}
		if(s[i] != '-')ans = false;
		i++;
		for(; i < n; i++){
			if(s[i]=='-')ans = false;
		}
		if(ans) cout << "Yes" << endl;
		else cout << "No"<< endl;
	}



}




Measured memory_bytes: 3600
#include<stdio.h>
int main()
{
  	int n,m,i,j;
  	char str[10];
  	scanf("%d %d",&n,&m);
  	for(i=1;i<=n;i++)
    {
      	for(j=1;j<=m;j++)
        {
         	scanf("%s ",str);
        	if(str[0]=='s' && str[1]=='n' && str[2]=='u' && str[3]=='k' && str[4]=='e')
            {
             	printf("%c%d",'A'+j-1,i);
              	return 0;
            }
        }
    }
  	return 0;
}

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

int main() {
    double a, b, h, m, w1, w2, t1, t2, t3, l3;
    cin >> a >> b >> h >> m;
    w1 = 2.0 * M_PI / 720.0;
    w2 = 2.0 * M_PI / 60.0;
    t1 = w1 * (h * 60.0 + m);
    t2 = w2 * m;
    t3 = abs(t1 - t2);
    l3 = sqrt(a * a + b * b - (2 * a * b * cos(t3)));
    printf("%.9lf\n", l3);
}


Measured memory_bytes: 4256
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

/*
mod 6で

3 を偶数個(最大5,000個)
2と4を同数(あわせて最大10,000個)
0 を任意個(最大5,000個)

とればよい

*/

void main(){
	int n = read.to!int;
	
	if(n == 3){
		writeln("2 5 63");
		return;
		}
	
	int[] ans;
	
	int x3, x2, x4, x6;
	if(n <= 5002){
		x3 = (n - 2) / 2 * 2;
		x2 = 1;
		x4 = 1;
		x6 = n - x3 - x2 - x4;
		}
	else if(n <= 15000){
		x3 = 5000;
		x2 = 1 + (n - 5002) / 2 ;
		x4 = 1 + (n - 5002) / 2 ;
		x6 = n - x3 - x2 - x4;
		}
	else{
		x3 = 5000;
		x2 = 5000;
		x4 = 5000;
		x6 = n - x3 - x2 - x4;
		}
	
	for(int i = 0; i < x3; i ++) ans ~= 3 + i * 6;
	for(int i = 0; i < x2; i ++) ans ~= 2 + i * 6;
	for(int i = 0; i < x4; i ++) ans ~= 4 + i * 6;
	for(int i = 0; i < x6; i ++) ans ~= 6 + i * 6;
	
	ans.to!(string[]).join(" ").writeln;
	
	}


Measured memory_bytes: 3196
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


A, B = list(map(int, sys.stdin.readline().split()))
print(max(A+B, A-B, A*B))





Measured memory_bytes: 23604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
double pi = acos(-1);
ll a[1000005];
ll tp[1000005];
ll l[1000005];
ll h[1000005];
vector<ll> e[1000005];

int main()
{
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    double hj = h * 30;
    hj += 30.0 * (m / 60.0);
    double fj = 6 * m;
    double jj = abs(hj - fj);
    jj = jj * pi / 180.0;
    double ans = a * a+ b * b - 2 * a * b * cos(jj);
    ans = sqrt(ans);
    printf("%0.10f\n",ans);
    return 0;
}


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

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

  cout << *max_element(point.begin(), point.end()) - *min_element(point.begin(), point.end()) << endl;
}

Measured memory_bytes: 256
public class Main {
	public static void main(String[] args) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		int l =0;
		int [][] ar = new int[0][2];
		int [][] arc = new int[0][2];
		while (true) {
			int h = sc.nextInt();
			int w = sc.nextInt();
			if (h == 0 && w == 0) {
				break;
			}
			l++;
			ar = new int[l][2];
			for (int i = 0; i < l - 1; i++) {
				ar[i] = arc[i];
			}
			ar[l - 1] = new int[] { h, w };
			arc = new int[l][2];
			for (int i = 0; i < l; i++) {
				arc[i] = ar[i];
			}
		}

		for (int i = 0; i < ar.length; i++) {
			int h = ar[i][0];
			int w = ar[i][1];

			String sYoko = "";
			for (int j = 0; j < w; j++) {
				sYoko = sYoko + "#";
			}
			//String sHako = "";
			for (int j = 0; j < h; j++) {
				//sHako = sHako + sYoko + "\n";
				System.out.println(sYoko);
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 27428
//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll n;
    cin>>n;
    vi v(n+1);
    rep(i,1,n){
        cin>>v[i];
    }
    ll curr=1;
    ll maxx=0;
    rep(i,2,n){
        if(v[i]<=v[i-1]){
            curr++;
        }
        else{
            maxx=max(maxx,curr);
            curr=1;
        }
    }
    maxx=max(maxx,curr);
    cout<<maxx-1;
    
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 1024
N = int(input())
a = [int(x) for x in input().split()]

cnt = 0
for i in range(N):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            cnt = 1

if cnt == 1:
    print("DENIED")
else:
    print("APPROVED")

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

int main() {
  int A, B;
  int i,j,k;
  int num_a, num_b, num_c;
  int count = 0;
  int x;
  
  cin >> A >> B;
  
  for (i = 0; i < 9; i++) {
  	num_a = i + 1;
    
    for (j = 0; j < 10; j++) {
      num_b = j;
      
      for (k = 0; k < 10; k++) {
        num_c = k;
        x = num_a * 10000 + num_b * 1000 + num_c * 100 + num_b * 10 + num_a;
        if (x >= A && x <= B) {
          count++;
        }
      }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
N = int(input())
for h in range(N // 4, 3501):
    for n in range(N * h // max(1, (4 * h - N)), 3501):
        mod = 4 * h * n - N * (h + n)
        if mod > 0:
            w, r = divmod(N * h * n, mod)
            if r == 0:
                print(h, n, w)
                exit()

Measured memory_bytes: 3060
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
int A[81][81], B[81][81];
bool dp[81][81][80*80*4+5] = {};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H,W;
    cin >> H >> W;
    rep(i,0,H){
        rep(j,0,W){
            cin >> A[i][j];
        }
    }
    rep(i,0,H){
        rep(j,0,W){
            cin >> B[i][j];
        }
    }
    // rep(i,0,H){
    //     rep(j,0,W){
    //         rep(k,0,161){
    //             dp[i][j][k] = I
    //         }
    //     }
    // }
    ll thre = 80*80*2;
    ll v = abs(A[0][0] - B[0][0]);
    dp[0][0][thre + v] = 1;
    rep(i,0,H){
        rep(j,0,W){
            rep(k,0,80*80*4+2){
                if(i+1 < H){
                    ll tt = abs(A[i+1][j] - B[i+1][j]);
                    if(dp[i][j][k]){
                        dp[i+1][j][k+tt] = true;
                        dp[i+1][j][k-tt] = true;
                    }
                }
                if(j+1 < W){
                    ll tt = abs(A[i][j+1] - B[i][j+1]);
                    if(dp[i][j][k]){
                        dp[i][j+1][k+tt] = true;
                        dp[i][j+1][k-tt] = true;
                    }
                }
            }
        }
    }
    ll ans = INF;
    rep(k,0,80*80*4+2){
        if(dp[H-1][W-1][k]){
            ans = min(ans, abs(k - thre));
        }
    }
    print(ans);


    

}

Measured memory_bytes: 162944
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    string S;
    cin >> S;
    vector<int> cnt(2, 0);
    for (int i = 0; i < S.size(); i++) { cnt[S[i] - '0']++; }
    cout << min(cnt[0], cnt[1]) * 2 << '\n';
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vector<int> p(n), q(n);
    for (int i = 0; i < n; ++i) {
        p[i] = i + a[i];
    }
    for (int i = 0; i < n; ++i) {
        q[i] = i - a[i];
    }
    sort(p.begin(), p.end());
    sort(q.begin(), q.end());
    ll ans = 0;
    for (int i : p) {
        ans += (upper_bound(q.begin(), q.end(), i) - q.begin()) - (lower_bound(q.begin(), q.end(), i) - q.begin());
    }
    cout << ans << endl;
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL<<60;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,m,n) for(int i=m;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(){
    int k;
    cin >> k;
    string s;
    cin >>s;
    int tmp=(s.length()<k)?s.length():k;
    
    REP(i,tmp){
        cout << s[i];
    }
    if(s.length()>k){
        cout<<"...";
    }
    cout << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define M 1000000007
#define pie 3.141592653589793238
using namespace std;


signed main(){  
    int x,k,d; cin >> x >> k >> d;
    x = abs(x);
    int move = x/d;
    int rem = x%d;
    if(rem == 0){
        if(k >= move){
            if((k-move)%2 == 0)
                cout << "0";
            else
                cout << d;
        }
        else{
            cout << (x-k*d);
        }
    }
    else{
        if((d-rem) < rem)
            move++;
        int mn = min(rem,(d-rem));
        if(k >= move){
            if((k-move)%2 == 0)
                cout << mn;
            else{
                if(mn == rem)
                    cout << d-rem;
                else
                    cout << rem;
            }
        }
        else{
            cout << (x-k*d);
        }
    }
    return 0;
}

Measured memory_bytes: 3544
package main

import "fmt"

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if a[i] > r {
			r = a[i]
		}
	}
	return r
}
func main() {
	var A, B int
	fmt.Scan(&A, &B)
	fmt.Println(max(A-2*B, 0))
}


Measured memory_bytes: 512
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

bool same[5004][5004];

int main(){
  int N;
  scanf("%d", &N);
  std::string s;
  std::cin >> s;
  for (int i=1; i<N; i++){
    for (int j=0; j<N; j++){
      if (j+i>=N) same[i][j]=false;
      else same[i][j]=(s[j+i]==s[j]);
    };
  }
  int ans = 0;
  for (int i=1; i<N; i++){
    int count_max = 0;
    int count = 0;
    for (int j=0; j<N; j++){
      if (same[i][j]) {
	count++;
	count_max=std::max(count, count_max);
      }
      else count=0;
    }
    count_max = std::min(count_max, i);
    ans = std::max(ans, count_max);
  }
  std::cout << ans << std::endl;
  return 0;
}
 

Measured memory_bytes: 27652
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	char a[100000];
	int b[100000];
	int c, d;
	int k;
	int n, m;
	int s, t;
	int x, y, z;

	for (int i = 0; i < 100000; i++)a[i] = 0;
	scanf("%s", a);

	for (int i = 0; i < strlen(a)-8; i++){
		printf("%c", a[i]);
	}

	printf("\n", s);

	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<tuple<string,int,int>> res(n);
  for(int i=1;i<=n;i++){
    string city;
    int point,order=i;
    cin >> city >> point;
    point = -point;
    res.at(i-1) = make_tuple(city,point,order);
  }
  sort(res.begin(),res.end());
  for(int i=0;i<n;i++){
	string city;
    int point;
    int order;
    tie(city,point,order) = res.at(i);
    cout << order << endl;
  }
  return 0;
}

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

bool a[5002][5002]; 

bool f(int x,int y){
	if(x<0||x>=5002||y<0||y>=5002)return false;
	return a[x][y];
}

int main(){
while(1){
	for(int i=0;i<5002;i++)for(int j=0;j<5002;j++)a[i][j]=false;
	int n,x[5002],y[5002];
	scanf("%d",&n); if(n==0)break;
	for(int i=0;i<n;i++){ scanf("%d%d",&x[i],&y[i]); a[x[i]][y[i]]=true; }

	int ret=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			int sx=y[i]-y[j],sy=x[j]-x[i];
			if(f(x[i]+sx,y[i]+sy)&&f(x[j]+sx,y[j]+sy))ret=max(ret,sx*sx+sy*sy);
			else if(f(x[i]-sx,y[i]-sy)&&f(x[j]-sx,y[j]-sy))ret=max(ret,sx*sx+sy*sy);
		}
	}

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

Measured memory_bytes: 25636
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  # log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')

from collections import Counter


def main():
    N = I()
    a = []
    for i in range(N):
        j = ST()
        a.append(j)
    cnt = Counter(a)
    print('AC x ' + str(cnt['AC']))
    print('WA x ' + str(cnt['WA']))
    print('TLE x ' + str(cnt['TLE']))
    print('RE x ' + str(cnt['RE']))
    

if __name__ == '__main__':
    main()

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

#define all(x) (x).begin(),(x).end()
#define fastio ios_base::sync_with_stdio(false)

typedef double db;
typedef long long ll;
typedef unsigned long long ull;

typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

const int maxn = 1e5 + 5;


int dis[maxn];
int indeg[maxn];
bool vis[maxn];
vector < int > adj[maxn];

void dfs(int source) {
	assert(!vis[source]);
	vis[source] = true;

	for(int node : adj[source]) {
		dis[node] = max(dis[node], dis[source] + 1);
		--indeg[node];
		if(indeg[node] == 0) {
			dfs(node);
		}
	}
}

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

	for(int i = 0; i < m; ++i) {
		int v1, v2; cin >> v1 >> v2;
		adj[v1].push_back(v2);
		++indeg[v2];
	}

	for(int i = 1; i <= n; ++i) {
		if(!vis[i] and indeg[i] == 0) {
			dfs(i);
		}
	}

	int ans = 0;

	for(int i = 1; i <= n; ++i) {
		ans = max(ans, dis[i]);
	}

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

Measured memory_bytes: 9728
module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector            as V
import           Data.Maybe
import           Text.Printf

main :: IO ()
main = do
  _ <- getLine
  vs <- map read . words <$> getLine
  cs <- map read . words <$> getLine
  print $ (max 0 . f . sortBy (flip compare) . zipWith (-) vs) cs
  where
    f as = sum $ 0:filter (>= 0) as


Measured memory_bytes: 636
#include <iostream>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;
using ll = long long;

const long double PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 1001001001;

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

    set<int> s;
    for(int i = -120; i <= 120; i++) s.insert(i);

    int p[n];
    int ans = 110;

    for(int i = 0; i < n; i++) {
        int p;
        cin >> p;
        s.erase(p);
    }

    int minimum = INF;

    for(auto t : s) {
        int diff = abs(t - x);
        if(diff < minimum) {
            ans = t;
            minimum = diff;
        }
    }

    /*
    for(int i = 100; i > 0; i--) {
        for(int j = 0; j < n; j++) {
            if(i == p[j]) continue;

            int diff = abs(i - x);

            if(diff < minimum) {
                ans = i;
                minimum = diff;
            }
        }
    }
    */

    cout << ans << endl;    

    return 0;
}

Measured memory_bytes: 3612
// ※※※ 解答不能 ※※※
// tourist氏.
// https://atcoder.jp/contests/cf17-relay-open/submissions/8923360
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repx(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)

int main(){
    int n, p;
    scanf("%d %d", &n, &p);
    vector<int> w(n);
    vector<int> b(n);
    rep(i, n) scanf("%d %d", &w[i], &b[i]);
    vector<LL> value(n);
    LL s = 0;
    rep(i, n){
        s -= p * 1LL * b[i];
        value[i] = (100LL - p) * w[i] + p * 1LL * b[i];
    }
    sort(value.rbegin(), value.rend());
    int ans = 0;
    rep(i, n){
        if(s < 0){
            s += value[i];
            ++ans;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(){
	int n,i,sum=0;
	cin>>n;
	int b[n];
	for(i=1;i<n;i++)cin>>b[i];
	sum+=b[1]+b[n-1];
	for(i=1;i<n-1;i++)sum+=min(b[i],b[i+1]);
	cout<<sum;
	return 0;
}


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


/*
    Judge wheter N is prime
    Time Complexity : O(sqrt(N))
*/


template<typename T> bool is_prime(T N) {
    if (N < 2 || N % 2 == 0) return(N == 2);
    for (long long i = 3; i*i <= N; i += 2) {
        if (N % i == 0) { return false; }
    }
    return true;
}



int main() {
    int N;
    cin >> N;
    
    while (is_prime(N) == false) N++;
    
    cout << N << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
ll pow1(ll a, ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
		{
			ans=ans*a;
		}
		a=a*a;
		b=b>>1;
	}
	return ans;
}
int main()
{
	int i,y,n,x;
	cin>>n>>x;
	vector<int> v;
	int num;
	for(i=0;i<n;i++)
	{
		cin>>y;
		v.pb(y);
	}
	sort(v.begin(),v.end());
	if(n==1)
	{
		cout<<abs(v[0]-x)<<endl;
		return 0;
	}
	// if(n==2)
	// {
	// 	cout<<min(abs(v[0]-x),abs(v[1]-x))<<endl;
	// 	return 0;
	// }
	for(i=1;i<n;i++)
		if(i == 1)
			num = v[1]-v[0];
		else
			num = __gcd(num,v[i]-v[i-1]);
	// cout<<num<<endl;
	if(num == 1)
	{
		cout<<1<<endl;
		return 0;
	}
	int ans = INT_MAX;
	for(i=0;i<n;i++)
	{
		if(v[i] == x)
			continue;
		if(abs(v[i]-x)%num == 0)
			ans = min(ans,__gcd(num,abs(v[i]-x)));
	}
	if(ans == INT_MAX)
		ans = 1;
	cout<<ans<<endl;
	return 0;
}

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

const int mod = 1000000007;
int n, i, a, b,  m;
int dp1 [100001];
int dp2 [100001];
vector <int> e [100001];

void dfs (int u, int f)
	{
	dp1[u]=1;
	dp2[u]=1;
	for (int v : e[u])
		if (v!=f)
			{
			dfs(v,u);
			dp1[u]=(1LL*dp1[u]*(dp1[v]+dp2[v]))%mod;
			dp2[u]=(1LL*dp2[u]*dp1[v])%mod;
			}
	}

int main ()
	{
	scanf ("%d",&n);
	for (i=1; i<n; i++)
		{
		scanf ("%d%d",&a,&b);
		e[a].push_back(b);
		e[b].push_back(a);
		}
	dfs(1,1);
	printf ("%d\n",(dp1[1]+dp2[1])%mod);
	return 0;
	}


Measured memory_bytes: 13440
N,D=map(int,input().split())
X=[tuple(map(int,input().split())) for i in range(N)]
def distsquare(z,y):
    res=0
    for i in range(D):
        res+=(z[i]-y[i])**2
    return res
def issquare(M):
    tmp=0
    while(tmp*tmp<=M):
        if tmp*tmp==M:
            return True
        tmp+=1
    return False
ans=0
for i in range(N):
    for j in range(N):
        if i<j:
            if issquare(distsquare(X[i],X[j])):
                ans+=1
print(ans)


Measured memory_bytes: 3064
n,m,b,a,t[100001],i;int main(){for(scanf("%d%*d",&n);++i<n;t[i]=t[i-1]+a)scanf("%d",&a);for(;~scanf("%d",&a);m+=a,b%=100000)b+=abs(t[m]-t[m+a]);n=!printf("%d\n",b);}

Measured memory_bytes: 752
#include<bits/stdc++.h>
#define ll long long 
using namespace std;

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

int main(){
    int x;
    cin >> x;
    int r = x % 100;
    int q = x / 100;
    if(r>q*5) cout << "0" << endl;
    else cout << "1" << endl;
}

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

int main(){
  long N,res=0,Max=0;
  cin >> N;
  long long H[N];
  for(long long i=0;i<N;i++){
    cin >> H[i];
  }
  for(long long i=0;i<N-1;i++){
    if(H[i]>=H[i+1]){
      Max++;
    }else{
      Max=0;
    }
    res = max(res,Max);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int a,b,c,n,m,answer;int s1,s2,s3,s4;
int main()
{  int max(int x,int y);
  int max1(int x,int y,int z);
   while(scanf("%d%d%d%d%d",&a,&b,&c,&n,&m)!=EOF)
   {
      if(n>m)
      {


        s1=(n-(n-m))*2*c+(n-m)*a;
        s2=n*2*c;
      }
        else
        {
            s1=(m-(m-n))*2*c+(m-n)*b;
            s2=m*2*c;
        }
        s3=a*n+b*m;
        answer=max1(s1,s2,s3);
        printf("%d\n",answer);


   }

}
int max(int x,int y)
{
    return x<y?x:y;
}
int max1(int x,int y,int z)
{
    int a;
    a=max(x,y);
    return a<z?a:z;
}

Measured memory_bytes: 128
//
// Created by Hideaki Imamura on 2020-03-21.
//
# include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

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

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

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int N, T;
vector<int> A, B;

int main() {
    cin >> N >> T;
    A.resize(N + 1);
    B.resize(N + 1);
    for (int i = 1; i <= N; ++i) cin >> A[i] >> B[i];

    vector <vector<int>> dp1(N + 2, vector<int>(T + 1, 0));
    vector <vector<int>> dp2(N + 2, vector<int>(T + 1, 0));
    for (int i = 0; i <= N - 1; ++i) {
        for (int j = 0; j < T; ++j) {
            chmax(dp1[i + 1][j], dp1[i][j]);
            if (j - A[i + 1] >= 0) chmax(dp1[i + 1][j], dp1[i][j - A[i + 1]] + B[i + 1]);
        }
    }
    for (int i = N + 1; i >= 2; --i) {
        for (int j = 0; j < T; ++j) {
            chmax(dp2[i - 1][j], dp2[i][j]);
            if (j - A[i - 1] >= 0) chmax(dp2[i - 1][j], dp2[i][j - A[i - 1]] + B[i - 1]);
        }
    }

    int ans = 0;
    for (int i = 1; i <= N; ++i) {
        for (int j = 1; j < T; ++j) {
            chmax(ans, dp1[i-1][j] + dp2[i+1][T - 1 - j] + B[i]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 70912
n, k = list(map(int, input().split()))
P = list(map(int, input().split()))

dp = [0] * n
m = {}

def func(x):
    return m.get(x, sum(range(x+1)) / x)
    #return sum(range(x+1)) / x

for i in range(n):
    if i - k >= 0:
        dp[i] = dp[i - 1] - func(P[i - k]) + func(P[i])
    else:
        dp[i] += func(P[i]) + dp[i-1]

print(max(dp))

Measured memory_bytes: 71944
/** author: __nishad__ **/

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


typedef long long ll ;
typedef vector<ll> vll ;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(v) (v).begin(),(v).end()
#define precision(k) cout<<setprecision(k)<<fixed;
#define loop(i,a) for(int i=0; i<a;i++)
#define loop2(i,a,b) for(int i=(a);i<=(b);++i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define getpos(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define unq(v) sort(all(v)),(v).erase(unique((v).begin(),(v).end()),(v).end())
#define pb push_back
#define pi 3.14159265358979323
#define endl "\n"

int main()
{
    IOS;

    ll n, x, z, sum=0;
    cin>>n>>x;

    vll v;

    while(n--){
        cin>>z;
        v.pb(z);
        sum = sum + z;
    }

    x = x - sum;
    sort(all(v));

    //cout<<sum<<v[0]<<x;

    cout<<x/v[0]+v.size();



}





Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
using namespace std;

int main(){
    double T,X;
    cin >> T >> X;
    cout << T/X <<endl;
}

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

color = [0]*9
for i in range(n):
    if a[i] < 400:
        color[0] += 1
    elif 400 <= a[i] < 800:
        color[1] += 1
    elif 800 <= a[i] < 1200:
        color[2] += 1
    elif 1200 <= a[i] < 1600:
        color[3] += 1
    elif 1600 <= a[i] < 2000:
        color[4] += 1
    elif 2000 <= a[i] < 2400:
        color[5] += 1
    elif 2400 <= a[i] < 2800:
        color[6] += 1
    elif 2800 <= a[i] < 3200:
        color[7] += 1
    else:
        color[8] += 1

k = len(list(filter(lambda x: x > 0, color[:-1])))
print(1 if k == 0 else k, k + color[-1])


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;

ll dp[K_MAX][11];
int main(){
  ll k;
  cin >>k;
  if(k<9){
    cout <<k<<endl;
    return 0;
  }
  
  rep(i,K_MAX) rep(j,11) dp[i][j]=0;
  
  rep(j,10) {//1桁の初期化
    dp[1][j]=1; 
  }
  k-=9;
  string ans="";
  

  
  for(int i=2;i<=K_MAX;++i){
    dp[i][0]=dp[i-1][0]+dp[i-1][1];

    rep1(j,9){
      dp[i][j]=dp[i-1][j-1]+dp[i-1][j]+dp[i-1][j+1];
      //cout <<i<<" "<<j<<" "<<dp[i][j]<<endl;
      if(k<=dp[i][j]){
        int j3=j;
        ans+=to_string(j3);
        //cout <<"j"<<j<<endl;
        for (int i2=i-1;i2>=1;--i2){
          for(int j2=j3-1;j2<=j3+1;++j2){
            if(k<=dp[i2][j2]){
              j3=j2;
              ans+=to_string(j3);
              break;
            }
            k-=dp[i2][j2];
          }
        }
        cout <<ans<<endl;
        return 0;
      }
      k -=dp[i][j];
    }
  }
  
}


Measured memory_bytes: 12288
import numpy as np


def main():
    W, H, N = map(int, input().split())
    s = np.zeros((W, H))
    for _ in range(N):
        x, y, a = map(int, input().split())

        if a == 1:
            s[:x, :] = 1
        elif a == 2:
            s[x:, :] = 1
        elif a == 3:
            s[:, :y] = 1
        elif a == 4:
            s[:, y:] = 1

    print(W * H - np.sum(s))


if __name__ == "__main__":
    main()

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];

  vector<vector<int>> cnt_i(n, vector<int>(26, 0));
  rep(i, n) rep(j, s[i].size()) ++cnt_i[i][s[i][j] - 'a'];

  vector<int> cnt(26, 100);
  rep(i, n) rep(j, 26) cnt[j] = min(cnt[j], cnt_i[i][j]);

  string ans = "";
  rep(i, 26) rep(j, cnt[i]) ans += i + 'a';
  cout << ans << endl;
  return 0;
}

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

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

  int n;
  cin >> n;
  long long ans = 800*n - (n/15)*200;
  cout << ans ;
  return 0;
}


Measured memory_bytes: 256
N,M=input().split(' ')
dict={}
for i in range(int(N)):
  dict[i+1]=0
for i in range(int(M)):
  a,b=input().split(' ')
  a=int(a)
  b=int(b)
  dict[a]+=1
  dict[b]+=1
for i in range(int(N)):
  print(dict[i+1])

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
  int n,i,j,num;
  int Card[5][14]={0};
  char Clue;
  char Symbol[5][1]={'n','S','H','C','D'};
  scanf("%d",&n);
  if(n<=52){
    for(i=0;i<n;i++){
      scanf("\n%c %d",&Clue,&num);
      if(Clue=='S'){
        Card[1][num]=1;
      }
      else if(Clue=='H'){
        Card[2][num]=1;
      }
      else if(Clue=='C'){
        Card[3][num]=1;
      }
      else if(Clue=='D'){
        Card[4][num]=1;
      }
    }
    for(i=1;i<=4;i++){
      for(j=1;j<=13;j++){
        if(Card[i][j]==0){
          printf("%c %d\n",Symbol[i][0],j);
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
	Scanner sc=new Scanner (System.in);
	int w=sc.nextInt();
	int n=sc.nextInt();
	int []values=new int[w];
	for(int i=0;i<values.length;i++){
	    values[i]=i+1;
	}
	for(int i=0;i<n;i++){
	    String str=sc.next();
	    String[] ab=str.split(",");
	    int a=Integer.parseInt(ab[0])-1;
	    int b=Integer.parseInt(ab[1])-1;
	    int c=values[a];
	    values[a]=values[b];
	    values[b]=c;
	}
	for(int i=0;i<values.length;i++){
	    System.out.println(values[i]);
	}
    }
}

Measured memory_bytes: 17200
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>
#include <bitset>

using namespace std;
typedef long long ll;

const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  vector<int> list(N);
  for (int i = 0; i < N; i++) {
    cin >> list[i];
  }
  
  ll dp[N + 1];
  for (int i = 0; i <= N; i++) {
    dp[i] = INF;
  }
  
  dp[0] = 0;
  for (int i = 0; i < N - 1; i++) {
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(list[i + 1] - list[i]));
    if (i + 2 < N) {
      dp[i + 2] = min(dp[i + 2], dp[i] + abs(list[i + 2] - list[i]));
    }
  }
  cout << dp[N - 1] << endl;
  return 0;
}


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

int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int n,T;
  while(cin >> n >> T, n){
    vector< vector<int> > cycle(n);
    for(int i=0;i<n;i++){
      int tmp;
      while(cin >> tmp, tmp)cycle[i].push_back(tmp);
    }
    vector<int> pos(n,0), end_time(n);
    for(int i=0;i<n;i++){
      end_time[i] = cycle[i][0];
      (pos[i] += 1) %= cycle[i].size();
    }

    queue<int> q;
    int charge = -1, charge_id = -1;
    int ans = 0;

    for(int t=0;t<T;t++){
      for(int i=0;i<n;i++){
	if(t==end_time[i]){
	  end_time[i] = -1;
	  q.push(i);
	}
      }
      
      if(charge <= t){
	if(charge_id>=0){
	  end_time[charge_id] = t + cycle[charge_id][pos[charge_id]];
	  (pos[charge_id] += 1) %= cycle[charge_id].size();
	  charge = charge_id = -1;
	}

	if(q.size()){
	  int nxt = q.front(); q.pop();
	  charge = t + cycle[nxt][pos[nxt]];
	  (pos[nxt] += 1) %= cycle[nxt].size();
	  charge_id = nxt;
	}
      }

      ans += q.size();
    }
	  
    cout << ans << endl;
  }
}

Measured memory_bytes: 1240
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

A, B, H, M = na()
l = 360 / 12 * (H + M / 60)
s = 360 / 60 * M
print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(abs(l - s) * math.pi / 180)))

Measured memory_bytes: 11068
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(true){
			int a = stdIn.nextInt();
			String op = stdIn.next();
			int b = stdIn.nextInt();
			if(op.equals("?"))
				break;
			switch (op.charAt(0)) {
				case '+':System.out.println((a+b)); break;
				case '-':System.out.println((a-b)); break;
				case '*':System.out.println(a*b); break;
				case '/':System.out.println(a/b); break;
			}
		}
	}
}

Measured memory_bytes: 18048