akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String c1 = br.readLine();
            String c2 = br.readLine();
            if (c1.charAt(0) == c2.charAt(2) && c1.charAt(1) == c2.charAt(1) && c1.charAt(2) == c2.charAt(0)) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int flag=0,i;
    string s;
    string t;
    cin>>s;
    cin>>t;
    for(i=0; s[i]; i++)
    {
        char a, b;
        a=s[i];
        b=t[i];
        if(a!=b)
            flag=1;
    }
    if(t.length()-s.length()!=1)
        flag=1;
    if(flag)
        cout<<"No\n";
    else
        cout<<"Yes\n";
}


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

#define int long long
#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define all(x) begin(x),end(x)

int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;
		
signed main()
{
    flash
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		string s;
		cin>>s;
		int sum = 0;
		for(auto it:s)
		{
			sum+= (it-'0');
		}		
		if(sum%9)
		cout<<"No";
		else
		cout<<"Yes";
    }
    return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
char c[2][60];
set<char>st; 
ll ans;int n,i;
int main()
{
	cin>>n>>c[0]>>c[1];
	if(c[0][i]==c[1][i])
		ans=3,i=1;
	else
		ans=6,i=2;
	for(;i<n;i++)
	{
		if(c[0][i]==c[1][i])
		{
			if(c[0][i-1]==c[1][i-1])
				ans=ans*2%mod;
		}
		else
		{
			if(c[0][i-1]==c[1][i-1])
				ans=ans*2%mod;
			else
				ans=ans*3%mod;
			i++;
		}
	}
	cout<<ans<<endl;
	return 0;
}
/*
52
RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn
RLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn
*/

Measured memory_bytes: 256
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (declare #.OPT)
  (let* ((s (read-line))
         (n (length s))
         (nexts (make-array (list n 26) :element-type 'uint32))
         (dp (make-array (+ n 1) :element-type 'uint32 :initial-element #xffffffff))
         (seqs (make-array (+ n 1) :element-type 'list)))
    (declare ((simple-array character (*)) s)
             (uint31 n))
    (let ((table (make-array 26 :element-type 'uint31 :initial-element n)))
      (loop for i from (- n 1) downto 0
            do (setf (aref table (- (char-code (aref s i)) 97)) i)
               (dotimes (c 26)
                 (setf (aref nexts i c) (aref table c)))))
    (setf (aref dp n) 1)
    (setf (aref seqs n) (list #\a))
    (loop for i from (- n 1) downto 0
          for res = #xffffffff
          do (dotimes (c 26)
               (if (= n (aref nexts i c))
                   (when (< 1 res)
                     (setf res 1)
                     (setf (aref seqs i) (list c)))
                   (let ((new-value (+ 1 (aref dp (+ 1 (aref nexts i c))))))
                     (when (< new-value res)
                       (setf res new-value)
                       (setf (aref seqs i)
                             (cons c (aref seqs (+ 1 (aref nexts i c)))))))))
             (assert (/= res #xffffffff))
             (setf (aref dp i) res))
    (dolist (c (aref seqs 0))
      (declare ((mod 26) c))
      #+swank (write-char (code-char (+ c 97)))
      #-swank (write-byte (+ c 97) *standard-output*))
    (terpri)))

#-swank (main)


Measured memory_bytes: 43496
stdin = open(0).read().split('\n')
N, M = map(int,stdin[0].split())
AC = 0
WA = 0
d = {}
for i in range(1,M+1):
    p, S = stdin[i].split()
    if p in d:
        if d[p]!=0:
            if S=='AC':
                AC += 1
                WA += d[p]
                d[p] = 0
            else:
                d[p] += 1
    else:
        if S=='AC':
            d[p] = 0
            AC += 1
        else:
            d[p] = 1
print(AC,WA)

Measured memory_bytes: 25632
#include<bits/stdc++.h>
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using namespace std;
int main(){
  ll x,y;cin>>x>>y;
  ll n=0;
  while(x<=y){
    x*=2;
    n++;
    }
  cout<<n<<endl;
}

Measured memory_bytes: 256
// abc169_d
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

vector<pair<long long, long long>> prime_factorize(long long n) {
  vector<pair<long long, long long>> res;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p != 0)
      continue;
    int num = 0;
    while (n % p == 0) {
      ++num;
      n /= p;
    }
    res.push_back(make_pair(p, num));
  }
  if (n != 1)
    res.push_back(make_pair(n, 1));
  return res;
}

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  auto pf = prime_factorize(n);

  for (auto p : pf) {
    ll e = p.second, cur = 1, cnt = 0;
    while (e >= cur) {
      e -= cur;
      cnt++;
      cur++;
    }
    ans += cnt;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m;
  cin>>n>>m;
  vector<int> v(n+1);
  for(int i=1;i<=n;i++)
	cin>>v[i];
  map<int,set<int>> mp;
  for(int i=0;i<m;i++)
  {
    int x,y;
    cin>>x>>y;
    mp[x].insert(y);
    mp[y].insert(x);
  }
  vector<int> visited(n+1,0);
  int ans=0;
  for(int i=1;i<=n;i++)
  {
    if(visited[i])
      continue;
    if(mp.find(i)==mp.end())
    {
        ans++;
        continue;
    }
    int maxh=v[i];
    visited[i]=1;
    int t=0;
    for(auto it:mp[i])
    {
      if(v[it]>=maxh)
      {
        t=1;
        break;
      }
      visited[it]=1;
    }
    if(t==0)
    ans++;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 21424
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s,t;
  cin>>s;
  cin>>t;
  int len = s.length(), tLen = t.length();
  if(len+1!=tLen){
    cout<<"No";
    return 0;
  }
  for(int i=0;i<len;i++){
    if(s[i]!=t[i]) {
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes";
  return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
 
#define MAX 500000
#define INFTY 2000000000
 
void Merge(int[MAX], int, int, int);
void MergeSort(int[MAX], int, int);
 
int count = 0;
 
int main(){
 
  int i, n;
  int A[MAX];
 
  scanf("%d", &n);
 
  for(i =0; i < n; i++){
 
    scanf("%d", &A[i]);
 
  }
 
  MergeSort(A, 0, n);
   
  for(i = 0; i < (n - 1); i++){
       
    printf("%d ", A[i]);
 
  }
 
  printf("%d\n", A[i]);
 
  printf("%d\n", count);
  
  return 0;
 
}
void Merge(int A[MAX], int left, int mid, int right){
 
  int i, j, k;
 
  int n1, n2;
 
  n1 = mid - left;
  n2 = right - mid;
 
  int L[MAX], R[MAX];
 
  for(i = 0; i < n1; i++){
 
    L[i] = A[left + i];
 
  }
 
  for(i = 0; i < n2; i++){
 
    R[i] = A[mid + i];
 
  }
 
  L[n1] = INFTY;
  R[n2] = INFTY;
 
  i = 0;
  j = 0;
 
  for(k = left; k < right; k++){
 
    if(L[i] <= R[j]){
 
      A[k] = L[i];
 
      i++;
 
    }
    else{
 
      A[k] = R[j];
       
      j++;
 
    }
 
    count++;
 
  }
 
}
 
void MergeSort(int A[MAX], int left, int right){
 
  int mid;
 
  if((left + 1) < right){
 
    mid = (left + right) / 2;
 
    MergeSort(A, left, mid);
 
    MergeSort(A, mid, right);
 
    Merge(A, left, mid, right);
 
  }
 
}
 

Measured memory_bytes: 4512
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 goal = sc.nextInt();
        int day = 1;
        int coin = 0;
        
        while(coin < goal){
            coin += a;
            if(day % 7 == 0)
                coin += b;
            day++;
        }
        System.out.println(day-1);
    }
}


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

int main()
{
  ll n,W;
  cin>>n>>W;
  ll weight[n],val[n];
  for(ll i=0;i<n;i++)
  {
    cin>>weight[i]>>val[i];
  }

  ll dp[n+1][100005];
  //memset(dp,0,sizeof(dp));
  for(ll i=0;i<n;i++)
    for(ll j=0;j<100001;j++)
      dp[i][j]=100000000000;
  for(ll i=0;i<n;i++)
  {
    if(i==0)
    {
      dp[i][val[i]]=weight[i];
      continue;
    }
    dp[i][val[i]]=min(dp[i][val[i]],weight[i]);
    for(ll j=0;j<100005;j++)
    {
        dp[i][j]=min(dp[i][j],dp[i-1][j]);
        if(val[i]<j)
          dp[i][j]=min(dp[i][j],dp[i-1][j-val[i]]+weight[i]);

    }
  }

  for(ll i=100000;i>=0;i--)
  {
    if(dp[n-1][i]<=W)
    {
      cout<<i<<endl;
      break;
    }
  }
  return 0;

}

Measured memory_bytes: 81780
#include <bits/stdc++.h>
#include <boost/range.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>
using namespace std;
constexpr char nl = '\n';
using ll = long long;
using boost::irange;
namespace rng { using namespace boost; using namespace boost::range; }
namespace adp { using namespace boost::adaptors; }

struct init_ { init_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } init_;

template<class C> auto operator>>(istream& in, C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, istream&>::type {
    for (auto& v : c) { in >> v; } return in; }
template<class C> auto operator<<(ostream& out, const C& c) -> typename enable_if<!is_void<decltype(c.begin())>::value && !is_same<C, string>::value, ostream&>::type {
    int i = 0; for (const auto& v : c) { if (i++) { out << ' '; } out << v; } return out; }
template<size_t N, class T, class R> using when_last = typename enable_if<N == tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N, class T, class R> using when_init = typename enable_if<N != tuple_size<remove_reference_t<T>>::value - 1, R>::type;
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_last<N, T, istream&> { return in >> get<N>(t); }
template<size_t N = 0, class T> auto operator>>(istream& in, T&& t) -> when_init<N, T, istream&> { return operator>><N + 1>(in >> get<N>(t), forward<T>(t)); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_last<N, T, ostream&> { return out << get<N>(t); }
template<size_t N = 0, class T> auto operator<<(ostream& out, const T& t) -> when_init<N, T, ostream&> { return operator<<<N + 1>(out << get<N>(t) << ' ', t); }

#ifdef LOCAL
constexpr auto color_s_ = "\033[2m\033[33m", color_e_ = "\033[0m";
template<class T> void trace_(const T& v) { cerr << v; }
template<class T> void trace_(const vector<vector<T>>& m) { cerr << "\n"; for (const auto& v : m) { trace_(v); cerr << "\n"; } }
template<class T> void trace_(const char* s, const T& v) { cerr << color_s_ << s << "="; trace_(v); cerr << color_e_ << "\n"; cerr.flush(); }
template<class T, class... Ts> void trace_(const char* s, const T& v, const Ts&... vs) { cerr << color_s_; for (; *s != ','; ++s) { cerr << *s; } cerr << "="; trace_(v); cerr << ","; trace_(++s, vs...); }
#define TRACE(...) trace_(#__VA_ARGS__, __VA_ARGS__)
#else
#define TRACE(...)
#endif

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    for (int i : irange(1, 1000)) {
        if (a <= k * i && k * i <= b) {
            cout << "OK" << nl;
            return 0;
        }
    }
    cout << "NG" << nl;
}


Measured memory_bytes: 3640
K = int(input())
num_list = [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]

print(num_list[K-1])

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,c;string b;cin >> a >> b;
  if(b.length()==5) c = (b[0]-'0')*1000+(b[1]-'0')*100+(b[3]-'0')*10+(b[4]-'0');
  else c = (b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
  cout << a*c/100 << "\n";
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
    char al;
    cin >> al ;
    if (al >= 'a' && al <= 'z'){
        cout << 'a' << endl;
    }
    else{
        cout << 'A' << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
import java.io.{BufferedReader, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}

object Main {
  val MOD = 1000000007
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val N, M = sc.nextInt()
    val items = Array.ofDim[(Long, Long, Long)](N)
    (0 until N) foreach { i =>
      val x, y, z = sc.nextLong()
      items(i) = (x, y, z)
    }

    val ans = (for {
      x_p <- Seq(1, -1)
      y_p <- Seq(1, -1)
      z_p <- Seq(1, -1)
    } yield {
      Sorting.quickSort(items)(Ordering.by[(Long, Long, Long), Long] { case (x, y, z) =>
          x * x_p + y * y_p + z * z_p
      }.reverse)
      val x = items.take(M).map(_._1).sum
      val y = items.take(M).map(_._2).sum
      val z = items.take(M).map(_._3).sum
      abs(x) + abs(y) + abs(z)
    }).max

    println(ans)
  }


  def main(args: Array[String]): Unit = {
    solve()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

}


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

signed main(){
	int a,b,c; cin>>a>>b>>c;
	cout<<(((c-a-b)*(c-a-b)-4*a*b>0 and c-a-b>0) ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
print(sum([abs(x-y) for x, y  in zip(x, y)]))
print(sum([abs(x - y) ** 2 for x, y  in zip(x, y)]) ** (1/2) )
print(sum([abs(x - y) ** 3 for x, y  in zip(x, y)]) ** (1/3) )
print(max([abs(x-y) for x, y  in zip(x, y)]))



Measured memory_bytes: 5648
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int x = sc.nextInt();
        int[] array = new int[n];
        for(int i=0; i<array.length; i++){
            int a = sc.nextInt();
            int k = 1;
            int count = 1;
            x+=k;
            k = count*a+1;
            while(k <= d){
                x++;
                count++;
                k = count*a+1;
            }
        }
        System.out.println(x);
    }

    public static void printListOneLine(List list){
        for(int i=0; i<list.size(); i++){
            System.out.println(list.get(i));
        }
    }

    public static void printList(List list){
        for(int i=0; i<list.size(); i++){
            if(i == list.size()){
                System.out.println(list.get(i));
            } else {
                System.out.print(String.format("%d ", list.get(i)));
            }
        }
    }

    public static void printArray(int[] array){
        for(int i=0; i<array.length; i++){
            if(i == array.length){
                System.out.println(array[i]);
            } else {
                System.out.print(String.format("%d ", array[i]));
            }
        }
    }

    public static int gcd(int a, int b){
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static int lcm(int a, int b){
        return a * b / gcd(a, b);
    }
}


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

using namespace std;

constexpr int MAXN=1e5+5,MAXM=2e5+5;
int n;
int head[MAXN];
int pre[MAXN];

struct Edge{int to,next;}edge[MAXM*2];

void add_edge(int u,int v){
	static int ecnt;
	auto add=[](int u,int v)->void{
		edge[++ecnt]=Edge{v,head[u]};
		head[u]=ecnt;
	};
	add(u,v),add(v,u);
}

void BFS(){
	fill_n(pre+1,n,-1);
	pre[1]=0;
	queue<int> que;
	que.push(1);
	while(!que.empty()){
		int u=que.front();
		que.pop();
		for(int i=head[u];i;i=edge[i].next){
			int v=edge[i].to;
			if(pre[v]==-1){
				pre[v]=u;
				que.push(v);
			}
		}
	}
}

int main(){
	int m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i){
		int u,v;
		scanf("%d%d",&u,&v);
		add_edge(u,v);
	}
	BFS();
	puts("Yes");
	for(int i=2;i<=n;++i)
		printf("%d\n",pre[i]);
}


Measured memory_bytes: 7768
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n=int(io())
	hs = list(map(int, io().split()))
	max_h=0
	nn=0
	for i, h in enumerate(hs):
		if h >= max_h:
			nn+=1
			max_h=h
	return nn

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

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

const int n_MAX = 100000;

int main() {
  int n, k;
  int h[n_MAX];

  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> h[i];

  int count = 0;
  for (int i = 1; i <= n; ++i) {
    if (k <= h[i]) ++count;
  }

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
//#include <vector>
//#include <math.h>
#include <string>

int main(void);
int kiriage(int num);


int main(){
	int n;					//n週
	int debut = 100000;		//借金
	std::cin >> n;

	for (int i = 0; i < n; i++)
	{
		debut *= 1.05;
		std::string str_debut = std::to_string(debut);
		if ((str_debut[str_debut.length() - 1] == '0') &&
			(str_debut[str_debut.length() - 2] == '0') &&
			(str_debut[str_debut.length() - 3] == '0')
			){
			;
		}
		else{
			debut = kiriage(debut);
		}
	}

	std::cout << debut << std::endl;

	//while (1);
	return 0;
}

//1000円未満を切り上げる関数
int kiriage(int num){
	num = num / 1000 * 1000 + 1000;
	
	return num;
}


Measured memory_bytes: 3200
n,k=map(int,input().split())
d=list(input().split())
flag=0
m=n
while (flag==0):
    str_m=list(str(m))
    for j in d:
        if(j in str_m):
            m+=1
            flag=2
            break
    if(flag==2):
        flag=0
        continue
    else:
        flag=1

print(int(m))

Measured memory_bytes: 3060
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

int W, Q;

int sleep_cat(int id, int w, vector<int> &v){
  REP(i, W - w + 1){
    bool f = true;
    REP(j, w) if(v[i + j] != -1) f = false;
    if(!f) continue;
    REP(j, w) v[i + j] = id;
    return i;
  }
  return -1;
}

void wakeup_cat(int id, vector<int> &v){
  REP(i, W) if(v[i] == id) v[i] = -1;
}

int main() {
  while(cin >>W >>Q && W){
    vector<int> v(W, -1);
    REP(q, Q){
      char c; cin >>c;
      if(c == 's'){
        int id, w; cin >>id >>w;
        int res = sleep_cat(id, w, v);
        if(res == -1) cout <<"impossible" <<endl;
        else cout <<res <<endl;
      } else{
        int id; cin >>id;
        wakeup_cat(id, v);
      }
    }
    cout <<"END" <<endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1);
const ll MOD = 1000000007;

int main() {
  ll N,M; cin >> N >> M;
  set<ll> s;
  for (ll i = 1; i*i <= M; i++) {
    if (M % i == 0) {
      s.insert(i);
      s.insert(M/i);
    }
  }
  
  ll ans;
  for (auto i : s) {
    if (i * N <= M) ans = i;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<bool> in, vis;
vector<int> adj[100009], go;
int mx = -1;

void dfs(int u){
	int i;

	for(i=0; i< adj[u].size(); i++){
		if (vis[adj[u][i]] == false)
			dfs(adj[u][i]);
		go[u] = max(go[adj[u][i]] + 1, go[u]);
	}

	mx = max(go[u], mx);
	vis[u] = true;
}

int main()
{
	int n, m, i, x, y, cnt=0;
	cin >> n >> m;
	in.resize(n+1, false);
	go.resize(n+1, 0);
	vis.resize(n+1, false);
	for(i=0; i<m; i++){
		cin >> x >> y;
		adj[x].push_back(y);
		in[y] = true;
	}

	for(i=1; i<=n; i++){
		
		if(in[i] == false)
			dfs(i);
	}

	cout << mx << endl;
	return 0;
}


Measured memory_bytes: 16896
N = int(input())
 
As = 0
Bs = 0
ABs = 0
BAs = 0
 
for i in range (0, N):
	K = str(input())
	ABs+= K.count('AB')
	if K[0] == 'B':
		if K[-1] == 'A':
			BAs+=1
		else:
			Bs+=1
	elif K[-1] == 'A':
		As+=1

if BAs== 0:
	print(ABs+min(As, Bs))
elif As+Bs>0:
	print(ABs+BAs+min(As, Bs))
else:
	print(ABs+BAs-1)

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

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}
int field[3][101];
int n;
int tmptotal = 0;
int total = 0;

int dfs(int x, int y){
    tmptotal += field[x][y];
    if (x == 2 && y == n){
        if (tmptotal > total){
            total = tmptotal;
        }
        tmptotal -= field[x][y];
        return 0;
    }
    if (y < n){
        dfs(x, y+1);
    }
    if (x < 2){
        dfs(x+1, y);
    }

    tmptotal -= field[x][y];
    return 0;
}



int main(void){
    int tmp;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++){
        scanf("%d", &tmp);
        field[1][i] = tmp;
    }
    for (int i = 1; i <= n; i++){
        scanf("%d", &tmp);
        field[2][i] = tmp;
    }
    dfs(1, 1);

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


Measured memory_bytes: 128
'use strict';

function Main(INPUT) {
    const input = INPUT.split("\n")[0].split(" ").map(n => Number(n));
    console.log(input[0] * input[1] < input[2] ? input[0] * input[1] : input[2]);
}

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


Measured memory_bytes: 7372
n = int(input())
A = list(map(int, input().split()))
minus = 0
for i in range(n):
    if A[i] < 0:
        minus += 1
        A[i] *= -1
if minus % 2 == 0:
    ans = sum(A)
else:
    ans = sum(A) - min(A)*2
print(ans)


Measured memory_bytes: 14332
/* به نام یزدان */
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	long long k, a, b;
	cin >> k >> a >> b;
	long long k_org = k, ans = a;
	k -= a - 1;
	if (k % 2)
		ans++, k--;
	k /= 2;
	ans += k * (b - a);
	if (b - a <= 2 || k < 0)
		cout << k_org + 1;
	else
		cout << ans;
}


Measured memory_bytes: 256
import sys, math
from collections import defaultdict
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
A = rl()
B = rl()

ans = 0
for i in range(N):
	for j in range(2):
		if A[i+j] >= B[i]:
			ans += B[i]
			A[i+j] -= B[i]
			B[i] = 0
		else:
			ans += A[i+j]
			B[i] = B[i] - A[i+j]
			A[i+j] = 0
print(ans)


Measured memory_bytes: 97572
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A, B, K;
  cin >> A >> B >> K;
  int g = __gcd(A, B);
  for (int i = 0; i < K; i++, g--)
    while (A % g || B % g) g--;
  cout << g + 1 << '\n';
  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



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

  int T,A;
  T=A=1;
  for(int i=1;i<=N;i++){
    int x,y;cin>>x>>y;
    int n=max((T+x-1)/x,(A+y-1)/y);
    T=n*x,A=n*y;
  }

  cout<<A+T<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		String[] s = new String[h];
		for(int i = 0; i < h; i++) {
			s[i] = sc.next();
		}
		boolean flag = true;
		while(flag) {
			flag = false;
			for(int i = 0; i < w; i++) {
				boolean white = true;
				for(int j = 0; j < h; j++) {
					if(s[j].charAt(i) != '.') {
						white = false;
						break;
					}
				}
				if(white) {
					for(int j = 0; j < h; j++) {
						s[j] = s[j].substring(0, i) + s[j].substring(i + 1);
					}
					flag = true;
					w--;
					break;
				}
			}
			for(int i = 0; i < h; i++) {
				boolean white = true;
				for(int j = 0; j < w; j++) {
					if(s[i].charAt(j) != '.') {
						white = false;
						break;
					}
				}
				if(white) {
					for(int j = i; j < h - 1; j++) {
						s[j] = s[j + 1];
					}
					flag = true;
					h--;
					break;
				}
			}
		}
		for(int i = 0; i < h; i++) {
			System.out.println(s[i]);
		}
	}

}


Measured memory_bytes: 25172
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  string S;
  cin >> N >> S;
  N = N % 26;
  for (int i = 0; i < S.size(); i++)
  {
    char c = S.at(i) + N;
    if (c > 90)
    {
      c = c - 26;
    }
    cout << c;
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
#define X 1000000
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll usort(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll dsort(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll ssort(const void *a, const void *b){return strcmp((char*)a,(char*)b);}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll z(ll a){return max(a,-a);}
ll gcd(ll a,ll b){if(!b){return a;}else{return gcd(b,a%b);}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll kt(ll a){
  ll sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
ll ks(ll a){
  ll sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
void ppp(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (int i=2;i<X;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
ll nCr(int n,int k){
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}

int jank(int a){
  char s[4]="spr";
  FOR(3)if(a==s[i])return i;
}
ll x[100000];
int main(void){
  char s[11],t[11],u[11];
  int a,b;
  scanf("%s %s %d %d %s",s,t,&a,&b,u);
  if(strcmp(s,u)==0){
    printf("%d %d\n",a-1,b);
  }else{
    printf("%d %d\n",a,b-1);
  }
}


Measured memory_bytes: 128
#include <cstdio>
using namespace std;

int main(){
	char p;
	int x, n;
	long long c = 0;
	bool yes = true;

	scanf("%d", &n);
	for(int i = 0; i < n; ++i){
		scanf(" %c%d", &p, &x);
		if(p == '('){
			c += x;
		}
		else{
			if((c -= x) < 0){ yes = false; }
		}
	}
	if(c != 0){ yes = false; }
	
	puts(yes ? "YES" : "NO");
}

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

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define f first
#define s second

using namespace std;

typedef long long ll;

int main(){
  string str;
  int n;
  getline(cin, str); sscanf(str.c_str(),"%d",&n);
  while(n --> 0){
    int pos;
    getline(cin, str);
    while((pos = str.find("Hoshino")) != string::npos){
      str[pos+6] = 'a';
    }
    cout << str << endl;
  }
  return 0;
}

Measured memory_bytes: 0
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let kazu: usize = read();
    let mut vec= Vec::new();
    let mut lights = HashMap::new();
    //in
    for x1 in 0..kazu {
        let ans2: usize = read();
        vec.push(ans2);
    }

    //out
    let mut ppoint:usize=1;
    let mut count=0;
    lights.insert(ppoint, 1);
    for yy in 0..(kazu) {
        count+=1;
        let nextpoint:usize = vec[ppoint-1];
        if (nextpoint==2){
            print!("{}",count);
            return;
        }else if (lights.get(&nextpoint).is_some()){
            print!("-1");
            return;
        }{
            ppoint=nextpoint;
            lights.insert(ppoint, 1);
        }
    }
    print!("-1");
}

Measured memory_bytes: 12540
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)


int main() {
	int n;
	cin >> n;
	int64_t A[100010];
	rep(i, n) cin >> A[i];

	int res = 0;
	int cnt = 0;
	rep(i, n-1) {
		if (A[i]>=A[i+1]) cnt++;
		else {
			res = max(res, cnt);
			cnt = 0;
		}
		res = max(res, cnt);
	}
	cout << res << endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	string s, t;
	cin >> s >> t;
	int res = 0;
	rep (i, s.size()) res += (s[i] != t[i]);
	cout << res << endl;
    
    return 0;
}


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

int main()
{
    int x;
    cin >> x;
    if(x >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include <utility>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 9000000000000;
#define LX 100010
    ll A,B,N;
int main(){
    cin>>N;
    ll ans=1;
    EREP(i,N){
        ans*=(i%MOD);
        ans%=MOD;
    }
    cout<<ans%MOD<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    unsigned long long w,i,j,k,n,m,l;
    cin>>n>>w;
    unsigned long long stuff[n][2];//stuff[i][0]が重さでstuff[i][1]が価値
    for(i=0;i<n;i++){
        cin>>stuff[i][0]>>stuff[i][1];
    }
    long chart[n+1][w+1];
    for(i=0;i<n+1;i++){
        for(j=0;j<w+1;j++){
            if(i==0||j==0){
                chart[i][j]=0;
                continue;
            }
            if(j<stuff[i-1][0]){
            chart[i][j]=chart[i-1][j];
            continue;
            }
            k = chart[i-1][j-stuff[i-1][0]]+stuff[i-1][1];
            l = chart[i-1][j];
            m = chart[i][j-1];
            if(m<=k&&l<=k)
            chart[i][j]=k;
            else if(m<=l)
            chart[i][j]=l;
            else 
            chart[i][j]=m;
        }
    }
    cout<<chart[n][w]<<endl;
    return 0;
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, k;
vector<ll> a;
ll dp[110][100010];
ll mod = 1000000007;

int main() {
  cin >> n >> k;
  a.resize(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i <= n; ++i) dp[i][0] = 1;

  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= k; ++j)
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1] + mod -
                 (j - a[i - 1] - 1 >= 0 ? dp[i - 1][j - a[i - 1] - 1] : 0),
      dp[i][j] %= mod;
  cout << dp[n][k] << endl;
  return 0;
}

Measured memory_bytes: 81748
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    ll x;
    cin >> x;
    vector<ll> d;

    for(ll a=-200;a<=200;a++){
        for(ll b=-200;b<a;b++){
            ll check = a*a*a*a*a - b*b*b*b*b;
            if(check == x){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3172
$wpat = [
  1 | 2 | 4, 8 | 16 | 32, 64 | 128 | 256,
  1 | 8 | 64, 2 | 16 | 128, 4 | 32 | 256,
  1 | 16 | 256, 4 | 16 | 64
]

### subroutines

def win?(bds, ch)
  bits = 0
  b = 1

  for i in (0..8)
    bits |= b if bds[i] == ch
    b <<= 1
  end
  #printf("%09b\n", bits)

  for p in $wpat
    return true if (bits & p) == p
  end
  return false
end

### main

while (line = gets)
  bds = line.chomp.split("")

  if win?(bds, "o")
    puts "o"
  elsif win?(bds, "x")
    puts "x"
  else
    puts "d"
  end
end

Measured memory_bytes: 6120
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007

int main() {
    int x, sum = 0;
    cin >> x;

    for (int i = 1; ; ++i)
    {
        sum += i;
        if (sum >= x)
        {
            cout << i << "\n";
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>

using namespace std;

int main()
{
	int x0, y0, x1, y1, q, x2, y2;
	scanf("%d %d %d %d", &x0, &y0, &x1, &y1);
	scanf("%d", &q);
	for (int i = 0; i < q; i++)
	{
		scanf("%d %d", &x2, &y2);
		double x, y;
		x = (double)x0 + 1.0*(x1-x0)*((x1 - x0)*(x2 - x0) + (y1 - y0)*(y2 - y0)) / (pow(x1 - x0, 2) + pow(y1 - y0, 2));
		y = (double)y0 + 1.0*(y1-y0)*((x1 - x0)*(x2 - x0) + (y1 - y0)*(y2 - y0)) / (pow(x1 - x0, 2) + pow(y1 - y0, 2));
		printf("%.11lf %.11lf\n", x, y);
	}
	return 0;
}

Measured memory_bytes: 1072
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int readS = Integer.parseInt(reader.readLine());
    
    int hour = readS / 3600;
    readS -= hour * 3600;
    int minutus = readS / 60;
    readS -= minutus * 60;
    int second = readS;
    
    System.out.println(hour+":"+minutus+":"+second);
  }

}

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

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	vector<int> p(n);
	for (int i=0; i<n; i++)
		cin>>p[i];
	int ret=0;
	for (int i=1; i<n-1; i++)
		if((p[i-1]<p[i]&&p[i]<p[i+1])||(p[i-1]>p[i]&&p[i]>p[i+1]))
			ret++;
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 256
n, k = gets.chomp.split.map(&:to_i)
hs = Hash.new(0)
k.times do |_|
  _ = gets
  a = gets.chomp.split.map(&:to_i)
  a.each do |i|
    hs[i] += 1
  end
end

puts (1..n).to_a.count {|i| hs[i] < 1 }

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

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int n = 100 * r + 10 * g + b;
  if (n % 4 == 0) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
n=int(input())
s={}
for _ in range(n):
    a=str(input())
    s[a]=s.get(a,0)
    s[a]+=1
t=(max(s.values()))
ans=[]
for k in s:
  if s[k]==t:
    ans.append(k)
ans.sort()
print(*ans)

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

int main() {
  int N;
  cin >> N;
  
  int A[N];
  int flag=0;
  int count = 0;

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

  while(flag==0){
    for(int i=0;i<N;i++){
      if(A[i]%2==1){
      flag=1;
      } 
    A[i] /=2;
    }
    if(flag==0){
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 998244353;

int main(){
  long double a,b,h,m;
  cin >> a >> b >> h >> m;
  
  h*=30;
  h+=0.5*m;
  m*=6;
  long double x = h-m;
  if(x<0) x*=-1;
  x/=180;
  x*=3.1415926535897932384626;
  
  long double c=cos(x);
  
  long double ans = a*a+b*b-2*a*b*c;
  ans*=100;
  ans = pow(ans,0.5);
  ans/=10;
  cout << fixed << setprecision(11) << ans << endl;
  
  
}
  
  
  
  


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll k;
vl x;
ll ans;

int main(){
  for(ll i = 0;i < 5;i++){
    ll a;
    cin >> a;
    x.push_back(a);
  }
  cin >> k;
  for(ll i = 0;i < 5;i++){
    for(ll j = i+1;j < 5;j++){
      if(x[j]-x[i] > k) ans++;
    }
  }
  if(ans == 0) cout << "Yay!" << endl;
  else cout << ":(" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long LL;
const LL INF=1e18;
const int MAXN=60;
const double eps=1e-10;
LL a[MAXN];

int main()
{
    LL n;
    while(scanf("%lld",&n)!=EOF)
    {
        for(int i=1;i<=n;++i)
            scanf("%lld",&a[i]);
        bool flag=true;
        LL ans=0,div=0;
        int p=0;
        while(flag)
        {
            p=1;
            if(a[p]<n) flag=false;
            for(int i=2;i<=n;i++)
            {
                if(a[i]>a[p]&&a[i]>=n)
                {
                    flag=true;
                    p=i;
                }
            }
            if(flag)
            {
                div=a[p]/n;
                ans+=div;
                a[p]%=n;
                for(int i=1;i<=n;i++)
                    if(i!=p) a[i]+=div;
            }
        }
        printf("%lld\n",ans);
    }
	return 0;
}


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

#define int long long

using namespace std;

const int N = 2e5 + 10;

int32_t main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);    
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) cin >> v[i];
    sort(v.begin(), v.end());
    int ans = 0;
    for (int i = 0; i < k; ++i) ans += v[i];
    cout << ans;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <sstream>
#include <vector>
#include <map>
using namespace std;

int pt;
int main()
{
	string str;
	string ans = "";

	cin >> str;

	int len = str.length();

	for (int i = 0; i < len; i++) {
		if (str[i] == 'B') {
			for (int j = i - 1; j >= 0; j--) {
				if (str[j] != 'N') {
					str[j] = 'N';
					break;
				}
			}
			str[i] = 'N';
		}
	}

	for (int i = 0; i < len; i++) {
		if (str[i] != 'N') {
			ans += str[i];
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n=gets.to_i
d=gets.split(" ").map(&:to_i).sort
m=gets.to_i
t=gets.split(" ").map(&:to_i).sort
s=0
n.times{|i|
    if d[i]==t[s] then
        s+=1
        if s==m then
            break
        end
    end
}
if s==m then
    puts "YES"
else puts "NO"
end

Measured memory_bytes: 33992
#include <stdio.h>

int main(void){
    int A,B;
    
    scanf("%d %d",&A,&B);
    
    if(0 <= A && A <= 5){
        printf("0\n");
    }else if(A >= 13){
        printf("%d\n",B);
    }else{
        printf("%d\n",B/2);
    }
    
    return 0;
}



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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL N, D;
	cin >> N >> D;

	vector<vector<LL>> x(N);
	REP(i, N) {
		x[i].resize(D);
		REP(j, D) {
			cin >> x[i][j];
		}
	}

	LL ans = 0;
	REP(a, N) {
		FOR(b, a+1, N) {
			LL sum = 0;
			REP(j, D) {
				LL t = x[a][j] - x[b][j];
				sum += t * t;
			}

			LL s = sqrt(sum);
			if (s * s == sum) {
				ans += 1;
			}
		}
	}

	cout << ans << endl;;

	return 0;
}


Measured memory_bytes: 256
import numpy as np
import math

N, K = map(int, input().split(" "))
A = list(map(int, input().split(" ")))

A_np = np.array(A)

argmin = A_np.argmin() + 1

left = (math.ceil((argmin - K) / (K - 1)) + 1)
left = max(0, left)

already = (left - 1) * (K - 1) + K if left != 0 else 1

nokori = (N - already + 1)

right = (math.ceil((nokori - K) / (K - 1)) + 1)

print(right + left)


Measured memory_bytes: 25884
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

vector<int> mark;

bool nibu(const vector<vector<int>> &G, int v, int p, int m) {
    if (mark[v] != -1) {
        if (mark[v] == m) return true;
        return false;
    }
    mark[v] = m;
    for (int u : G[v]) {
        if (u == p) continue;
        if (!nibu(G, u, v, 1 - m)) return false;
    }
    return true;
}

int bfs(const vector<vector< int>> &G, int s) {
    int n = G.size();
    vector<bool> visited(n, false);
    queue<pair<int, int>> que; // 頂点,深さ
    que.push({s,1});
    visited[s] = true;
    int res = 0;
    while (!que.empty()) {
        pair<int, int> p = que.front(); que.pop();
        res = max(res, p.second);
        for (int v : G[p.first]) {
            if (visited[v]) continue;
            visited[v] = true;
            que.push({v,p.second + 1});
        }
    }
    return res;
}

int main() {
    int n; cin >> n;
    mark = vector<int>(n, -1);
    vector<vector<int>> G(n);
    vector<string> g(n);
    REP(i, n) cin >> g[i];
    REP(i, n) {
        FOR(j, i + 1, n) {
            if (g[i][j] == '1') {
                G[i].push_back(j);
                G[j].push_back(i);
            }
        }
    }
    if (!nibu(G,0,-1,0)) {
        puts("-1");
        return 0;
    }
    int ans = 0;
    REP(i, n) {
        ans = max(ans, bfs(G, i));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512