akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define F first
#define S second
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()
//library begin
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int log(int a){
    int b=a;
    int cnt=0;
    while(b%2==0){
        b/=2;
        cnt++;
    }
    return cnt;
}
int mypow(int a,int b){
    if(b==0)return 1;
    if(b==1)return a;
    int t=mypow(a,b/2);
    if(b%2==0)return t*t;
    return t*t*a;
}
//Union-Find;
#define MAX_N 200000
int par[MAX_N];
int siz[MAX_N];
int Rank[MAX_N];
void init(int n){
    rep(i,n){
        par[i]=i;
        siz[i]=1;
        Rank[i]=0;
    }
}
int find(int x){
    if(par[x]==x){
        return x;
    }else{
        return par[x]=find(par[x]);
    }
}
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    if(Rank[x]<Rank[y]){
        par[x]=y;
        siz[par[x]]=siz[x]+siz[y];
    }else{
        par[y]=x;
        siz[par[y]]=siz[x]+siz[y];
        if(Rank[x]==Rank[y])Rank[x]++;
    }
}
bool same(int x,int y){
    return find(x)==find(y);
}

//library end
int n;
int x[114];
int sum[114];
int ans=INF;
signed main(){
    cin>>n;
    rep(i,n)cin>>x[i];
    for(int i=1;i<=100;i++){
        rep(j,n){
            sum[i]+=(i-x[j])*(i-x[j]);
        }
    }
    for(int i=1;i<=100;i++){
        ans=min(ans,sum[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define CANCER ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define f first
#define s second
#define mod 1000000007

using namespace std;
int main()
{
	CANCER;
	double w,h,x,y;
	cin>>w>>h>>x>>y;
	cout<<setprecision(6)<<fixed<<w*h/2;
	if(x==w/2 && y==h/2)
		cout<<" 1";
	else
		cout<<" 0";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int a,b,c;
cin >> a >> b;
int ans = b;
if(6<=a&&a<=12) {
  ans /= 2;
} else if(a<=5) {
  ans = 0;
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
  string stro;
  cin >> stro;
  string stre;
  cin >> stre;
  for(int i = 0; i < stro.length(); ++i)
  
  {
  	cout << stro[i];
  	if(i < stre.length()) cout << stre[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
const ll INF = 114514810;
const ll MOD = 1000000007;
const double EPS = 1e-8;
const double PI = acos(-1.0);
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

int V;
int d[111111];
int s;
vector<edge> es[111111];

void dijkstra(int s)
{
	fill(ALL(d), INF);
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while (!que.empty())
	{
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first) continue;
		REP(i, es[v].size())
		{
			edge e = es[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main()
{
	cin >> V;
	REP(i, V)
	{
		int t;
		cin >> t;
		if (t == 0)
		{
			FOR(j, 1, 7)
			{
				es[i].push_back(edge{ i, i + j, 1 });
			}
		}
		else
		{
			es[i].push_back(edge{ i, i + t, 0 });
		}
	}
	dijkstra(0);
	cout << d[V-1] << endl;
	return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  int cnt = 1, num = 0;
  while(true){
    if(cnt >= B) break;
    cnt += (A - 1);
    num++;
  }
  cout << num << endl;
}


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

#define LL long long
vector<int> g[1001];
map<pair<int, int>, int> mp;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    int n, k; cin >> n >> k;
    int mx = (n - 2) * (n - 1) / 2;
    if(k > mx) return cout << -1, 0;
    int join = mx - k;

    for(int i = 2; i <= n; i++) g[1].push_back(i), g[i].push_back(1);
    int u = 2, v = 3, ans = n - 1 + join;
    
    while(join--) {
        g[u].push_back(v);
        g[v].push_back(u);
        v++;
        if(v > n) {
            u++, v = u + 1;
        }
    }
    cout << ans << '\n';
    for(int i = 1; i < n; i++) {
        for(int u : g[i]) {
            if(!mp[{i, u}]) {
                cout << i << " " << u << '\n';
                mp[{i,u}]++, mp[{u,i}]++;
            }
        }
    }
}

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

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {

            int n = int.Parse( Console.ReadLine());
            var a = Console.ReadLine().Split(' ');
            //Dictionary<long, int> keyValues = new Dictionary<long, int>();
            int out_num = 0;
            for(int i = 0;i<a.Length;i++)
            {
                var tmp = int.Parse(a[i]);
                int pow = 0;
                if(tmp % 2 == 0)
                {
                    while (tmp % 2 == 0)
                    {
                        tmp /= 2;
                        pow++;
                    }
                }
                out_num += pow;
            }

            Console.WriteLine(out_num);



        }


    }
}



Measured memory_bytes: 13792
N = int(input())
A, B = [0 for _ in range(N)], [0 for _ in range(N)]
C = [None for _ in range(N)]
for i in range(N):
    A[i], B[i] = map(int, input().split())
    C[i] = (A[i], B[i])

C.sort(key=lambda c: c[0])
C.sort(key=lambda c: c[1])

x = 0
p = True
for c in C:
    x += c[0]
    if x > c[1]:
        p = False
        break
print('Yes' if p else 'No')


Measured memory_bytes: 34960
#include<iostream>
#include<map>

using namespace std;

bool sosu(long int n)
{
	for(int i=2;i*i<=n;i++)
	{
		if(n%i==0)return false;
	}
	return true;
}

int main(void)
{
	long int n;
	while(cin>>n)
	{
		long int l,s;
		l=s=n;
		l++;s--;
		bool lf,sf;
		lf=sf=true;
		while(1)
		{
			if(lf)
			{
				if(sosu(l)) lf=false;
				else l++;
			}
			if(sf)
			{
				if(sosu(s)) sf=false;
				else s--;
			}
			if(lf==false&&sf==false) break;
		}
		cout<<s<<' '<<l<<endl;
	}
}

Measured memory_bytes: 1156
<?php
/*
    Problem URL : http://abc054.contest.atcoder.jp/tasks/abc054_a

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

fscanf(STDIN, "%d %d", $A, $B);

if ($A == 1) $A += 13;
if ($B == 1) $B += 13;

if ($A == $B) {
    echo "Draw\n";
} elseif ($A > $B) {
    echo "Alice\n";
} else {
    echo "Bob\n";
}


Measured memory_bytes: 2936
#include<iostream>
#include<cstring>
#include<cstdio>
#define MN 200
#define mod 998244353
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,b[MN+5][MN+5],x[MN+5],y[MN+5],ans,pw[MN+5],q[MN+5],top;
int main()
{
    n=read();pw[0]=1;
    for(int j=1;j<=n;++j) pw[j]=2*pw[j-1]%mod;ans=(pw[n]-n-1+mod)%mod;
    for(int i=1;i<=n;++i) x[i]=read(),y[i]=read();
    for(int i=1;i<=n;++i) for(int j=i+1;j<=n;++j) if(!b[i][j])
    {
        q[top=1]=i;q[top=2]=j;
        for(int k=j+1;k<=n;++k) if((x[j]-x[i])*(y[k]-y[i])-(x[k]-x[i])*(y[j]-y[i])==0) q[++top]=k;
        for(int l=1;l<top;++l) for(int r=l+1;r<=top;++r) b[q[l]][q[r]]=1;
        ans=((ans-pw[top]+top+1)%mod+mod)%mod;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                                     \
  ifstream in("atcoder-problems/abc061_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;
 
int main() {
  INPUT_FILE CIN_OPTIMIZE;
 
  int N, M;
  cin >> N >> M;
 
  vector<vector<int>> g(N, vector<int>(0));
  rep(i, M) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
 
  rep(i, N) { cout << g[i].size() << endl; }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<int> p(n);
  rep (i, n) cin >> p[i];
  int mini = INT_MAX, cnt = 0;
  rep (i, n) {
    if (p[i] < mini) ++cnt;
    mini = min(mini, p[i]);
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 1024
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    input! {
       N: usize,
       M:usize,
       path:[(Usize1,Usize1);M],
    }

    let mut ans: usize = 0;
    let mut map = vec![vec![]; N];
    for &(f, t) in &path {
        map[f].push(t);
        map[t].push(f);
    }
    let mut kouho = VecDeque::new();
    kouho.push_back((0, 0));
    let mut used = vec![None; N];
    used[0] = Some(0);
    while !kouho.is_empty() {
        let (p, depth) = kouho.pop_front().unwrap();
        for i in 0..map[p].len() {
            let next = map[p][i];
            if used[next].is_some() {
                continue;
            }
            used[next] = Some(p);
            kouho.push_back((next, depth + 1));
        }
    }

    echo!("Yes");
    for i in 1..N {
        echo!(used[i].unwrap() + 1);
    }
}


Measured memory_bytes: 18344
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String sPrime = sc.next();
		String subString = sc.next();
		
		if (subString.length() > sPrime.length()) {
			System.out.println("UNRESTORABLE");
		} else {
			int startInd = 0;
			boolean works = false;
			for (int i = sPrime.length() - subString.length(); i >= 0; i--) {
				if (sPrime.charAt(i) == '?' || sPrime.charAt(i) == subString.charAt(0)) {
					works = true;
					for (int j = 0; j < subString.length(); j++) {
						if (!(sPrime.charAt(i + j) == '?' || sPrime.charAt(i + j) == subString.charAt(j))) {
							works = false;
						}
					}
				}
				if (works) {
					startInd = i;
					break;
				}
			}
			if (!works) {
				System.out.println("UNRESTORABLE");
			} else {
				String newString = "";
				for (int i = 0; i < sPrime.length(); i++) {
					if (i >= startInd && i < startInd + subString.length()) {
						newString += subString.charAt(i - startInd);
					} else if (sPrime.charAt(i) == '?') {
						newString += 'a';
					} else {
						newString += sPrime.charAt(i);
					}
				}
				System.out.println(newString);
			}
		}
	}
}


Measured memory_bytes: 23380
#include<stdio.h>
#include<math.h>
int main(){
    int a,b,c;
    0<=a<=100;
    0<=b<=100;
    0<=c<=100;
    scanf("%d %d %d\n",&a,&b,&c);
    if(a < b && b < c){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}    


Measured memory_bytes: 2696
#include <iostream>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <stack>
#include <vector>
#include <cctype>

using namespace std;

typedef pair<int, int> P;

int n, m, last;
map<string, P> var;
stack<set<int> > st;
vector<string> input;

bool solve(){
   for(int i=0;i<input.size();i++){
      bool f = true;
      for(int j=0;j<input[i].size();j++){
	 if(!(input[i][j] >= '0' && input[i][j] <= '9')) f = false;
      }
      if(f){
	 int tmp = atoi(input[i].c_str());
	 set<int> tmp1;
	 tmp1.insert(tmp);
	 st.push(tmp1);
      }else if(input[i] == "+" || input[i] == "-" || input[i] == "*" || input[i] == "/"){
	 set<int> s1, s2, s3;
	 s2 = st.top();
	 st.pop();
	 s1 = st.top();
	 st.pop();
	 for(set<int>::iterator ite1 = s1.begin();ite1!=s1.end();ite1++){
	    for(set<int>::iterator ite2 = s2.begin();ite2!=s2.end();ite2++){
//	       cout << *ite1 << ' ' << *ite2 << endl;
	       if(input[i] == "+"){
		  s3.insert(((*ite1) + (*ite2)) % 256);
	       }else if(input[i] == "-"){
		  s3.insert(((*ite1) - (*ite2) + 256) % 256);
	       }else if(input[i] == "*"){
		  s3.insert(((*ite1) * (*ite2)) % 256);
	       }else if(input[i] == "/"){
		  if((*ite2) == 0) return false;
		  s3.insert(((*ite1) / (*ite2)) % 256);
	       }
	    }
	 }
	 st.push(s3);
      }else{
	 set<int> tmp;
	 for(int j=var[input[i]].first;j<=var[input[i]].second;j++){
	    tmp.insert(j);
	 }
	 st.push(tmp);
      }
   }
   return true;
}

main(){
   cin >> m;
   for(int i=0;i<m;i++){
      string name;
      int a, b;
      cin >> name >> a >> b;
      var[name] = P(a, b);
   }
   cin >> n;
   for(int i=0;i<n;i++){
      string in;
      cin >> in;
      input.push_back(in);
   }
   cout << (solve() ? "correct" : "error") << endl;
}

Measured memory_bytes: 1308
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

    cout<<n*(n-1)/2+m*(m-1)/2<<endl;

 return 0;
}

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

namespace ConsoleApp15 {
    class Program {
        static void Main(string[] args) {
            //入力
            string S = Console.ReadLine();

            //前半二文字
            string before = S.Substring(0, 2);
            //後半二文字
            string after = S.Substring(2, 2);

            //月の可能性をまとめたリスト
            string[] month = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };

            //回答となる文字列
            string ans;

            //実行
            if (month.Contains(before) && month.Contains(after)) {
                ans = "AMBIGUOUS";
            } else if (month.Contains(before)) {
                ans = "MMYY";
            } else if (month.Contains(after)) {
                ans = "YYMM";
            } else {
                ans = "NA";
            }

            //出力
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11220
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int X, Y;

		X = scan.nextInt();
		Y = scan.nextInt();

		int sum = X + Y / 2;

		System.out.println(sum);
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 21332
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int k = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		int ok = 1000000000;
		int ng = 0;
		while (Math.abs(ok - ng) > 1) {
			int mid = (ok + ng) / 2;
			if (count(a, mid) <= k) {
				ok = mid;
			} else {
				ng = mid;
			}
		}
		System.out.println(ok);
	}

	static long count(int[] a, int val) {
		long cnt = 0;
		for (int i = 0; i < a.length; i++) {
			cnt += (a[i] - 1) / val;
		}
		return cnt;
	}
}


Measured memory_bytes: 61592
// problem 3 : count it
#include <bits/stdc++.h>
using namespace std;

// Driver function
int main(){
    int h, n;
    cin >> h >> n;
    // vector<int> moves;
    int sum = 0, temp = 0;
    for(int i = 0; i < n; i++){
        cin >> temp;
        sum += temp;
    }

    // cout << sum << endl;
    if(sum >= h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> inline void sort_uniq(T& c) { sort(ALL(c)); c.erase(unique(ALL(c)), c.end()); }
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class K, class V> void cout_v(map<K, V>& m)
{ for(auto it=m.begin();it!=m.end();it++)cout<<it->first<<":"<<it->second<<endl;}
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
inline int powi(int x,int y) {int p=1; while(y--) p*=x; return p;}
inline ll powll(ll x,ll y) {ll p=1; while(y--) p*=x; return p;}
template<class T> inline bool is_overlap(const T& a, const T& b, const T& p, const T& q)
{ return p <=b && a <= q; }
#define MOD = 1000000007;
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
void yes(bool f){cout<<(f?"yes":"no")<<endl;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N; cin >>N;
    vector<int> d(N); cin >> d;
    sort(all(d));
    cout << d[N/2] - d[N/2-1] << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstring>
using namespace std;
int main(){
  char a[2000], b[2000], c[2000];
  cin >> a >> b >> c;
  int x=strlen(a);
  int y=strlen(b);
  int z=strlen(c);
  if(a[x-1]==b[0]){
  if(b[y-1]==c[0]){
      cout << "YES\n";
    }
    else cout << "NO\n";
  }
  else cout << "NO\n";

}

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

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

    vector<int> t(110000);
    vector<int> x(110000);
    vector<int> y(110000);
    t.at(0) = 0, x.at(0) = 0, y.at(0) = 0;
    for(int i = 1; i <= N; i++){
        cin >> t.at(i) >> x.at(i) >> y.at(i);
    }
    bool can = true;

    for(int i = 0; i < N; i++){
        int time = abs(t.at(i + 1) - t.at(i));
        int dist = abs(x.at(i + 1) - x.at(i)) + abs(y.at(i + 1) - y.at(i));
        if(dist > time) can = false;
        if(time % 2 != dist % 2) can = false;
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 4520
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val n = sc.nextInt

  val bv = Vector.fill(n - 1)(sc.nextInt)

  val res = (bv :+ Int.MaxValue).foldLeft((0, Int.MaxValue)){case ((sum, pre), b) =>
    (sum + Math.min(pre, b), b)
  }._1
  
  println(res)
}


Measured memory_bytes: 25524
object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datS) = readLine.split(" ")
    val Array(datT) = readLine.split(" ")

    val ans1 = (datS.length + 1 == datT.length)
    val ans2 = (datS == datT.substring(0, datS.length))
    val ans = ans1 && ans2
    println(if(ans) "Yes" else "No")
  }
}


Measured memory_bytes: 54664
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var d = rla();
		Console.WriteLine(d[0] * d[1]);
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

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

    for(int i=0; i<N; i++){
        if(A[i]%2==1) continue;
        if(!(A[i]%3==0 || A[i]%5==0)){
            cout << "DENIED" << endl;
            return 0;
        }
    }

    cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace  std;
template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

	
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<pii>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define re(n) for (int i = 0; i < n; ++i)
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define eb emplace_back

//OutPut
#define ps(x) cout << x << endl;
#define ps_end(x) {ps(x); return;}


const int md = 1e9 + 7; //998244353 ;
const int dir[4][2] = {{-1,0}, {1, 0}, {0, -1}, {0, 1}};
template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { 
	return a < b ? a = b, 1 : 0; }
ll pw(auto x, auto y) {	 ll s = 1; while(y) { if (y & 1) s = s * x % md; x= 1LL * x * x % md; y /= 2; } return s;}

const int maxn = 1e6 + 10;

int n, m, nq, nk;
string str;

void task() {
	
	ll x, k, d;
	cin >> x >> k >> d;
	x = abs(x);

	ll y = x / d;
	if (y >= k) {
		cout << x - k * d << endl;
		return;
	}	 
	x = x % d;
	k -= y;
	if (k % 2 == 1) x = d - x;

	cout << x << endl;
	
	
	//Read the stuff at the bottom
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout<<fixed<<setprecision(20);
  int T = 1;
  //cin >> T;
  for (int ti = 1; ti <= T; ++ti) {
    task();
  }
  return 0;
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* write down
*/


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
string a;
string pd="CODEFESTIVAL2016";
int c=16;
int main(){
    c+=1;
    c-=1;
    c+=1;
    c-=1;
    ios::sync_with_stdio(false);
    cin>>a;
    for(int i=0;i<16;i++) c-=(a[i]==pd[i])?1:0;
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " = " << x << endl
#define print(x) cout << x << endl;
const ll MOD = 1000000007;

int main()
{
    int N, M;
    cin >> N >> M;
    rep(i, M)
    {
        int A;
        cin >> A;
        N -= A;
    }
    if (N < 0)
    {
        cout << -1 << endl;
    }
    else
    {

        cout << N << endl;
    }
}


Measured memory_bytes: 3624
def main():
    H, W = map(int, input().split())
    S = []
    for _ in range(H):
        s = list(input())
        S.append(s)
    R = [[0]*W for _ in range(H)]
    L = [[0]*W for _ in range(H)]
    U = [[0]*W for _ in range(H)]
    D = [[0]*W for _ in range(H)]
    for i in range(H):
        cnt = 0
        for j in range(W):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                L[i][j] = cnt
    for i in range(H):
        cnt = 0
        for j in range(W-1, -1, -1):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                R[i][j] = cnt
    for j in range(W):
        cnt = 0
        for i in range(H):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                U[i][j] = cnt
    for j in range(W):
        cnt = 0
        for i in range(H-1,-1,-1):
            if S[i][j]=='#':
                cnt = 0
            else:
                cnt += 1
                D[i][j] = cnt
    ans = 0
    for i in range(H):
        for j in range(W):
            ans = max(ans, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 309888
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
	string s;
	int n = 0;
	cin >> s;
	for (int i = 0; i < 3; i++) {
		if (s[i] == '1') n++;
	}
	cout << n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll k;
    cin >> k;
    ll now = 7;
    ll cnt = 1;
    while(1){
        now %= k;
        if(now == 0){
            cout << cnt << endl;
            return 0;
        }
        now *= 10;
        now += 7;
        cnt++;
        if(cnt == 1000000){
            cout << -1 << endl;
            return 0;
        }
    }
    return 0;
}


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

ll knapsack(ll k, vector<pair<int,int>> v) {
  vector<ll> dp(k+1,0);
  for (auto p : v)
    for (int i = 0; i+p.first <= k; i++)
      dp[i+p.first] = max(dp[i+p.first], dp[i]+p.second);
  ll ans = 0;
  for (ll i : dp) ans = max(ans, i);
  return ans;
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  ll n;
  cin >> n;
  int a1, b1, c1, a2, b2, c2;
  cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
  vector<pair<int,int>> v1,v2;
  for (pair<int,int> p : vector<pair<int,int>>{{a1,a2},{b1,b2},{c1,c2}}) {
    int x1 = p.first, x2 = p.second;
    if (x1 < x2) v1.push_back({x1,x2-x1});
    if (x1 > x2) v2.push_back({x2,x1-x2});
  }
  n += knapsack(n, v1);
  n += knapsack(n, v2);
  cout << n << endl;
}


Measured memory_bytes: 195584
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		Stack<Integer> stk=new Stack<>();
		
		while(in.hasNext()) {
			int t=in.nextInt();
			if(t==0)System.out.println(stk.pop());
			else stk.push(t);
		}
		in.close();
	}

}


Measured memory_bytes: 26116
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d;
    scanf("%d %d",&a,&b);
    if(a<b){
        for(c=1; c<=b;c++)
        printf("%d",a);
    }
    else if(a>=b){
        for(c=1; c<=a; c++)
            printf("%d",b);
    }
}


Measured memory_bytes: 1716
#pragma GCC optimize("O3")

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define For(i, a, b)    for(int i = (a); (i) < (b) ; ++(i))
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int h, w; cin >> h >> w;
    vector<vector<char>> s(h, vector<char>(w));
    rep(i, h){
        string _s; cin >> _s;
        rep(j, w){
            s[i][j] = _s[j];
        }
    }

    vector<vector<bool>> b(h, vector<bool>(w));

    rep(i, h)rep(j, w){
        for(int k = 0; k < 4; ++k){
            int nx = dx[k];
            int ny = dy[k];

            if(0 <= i+ny && i+ny < h && 0 <= j+nx && j + nx < w)
                if(s[i][j] == '#' && s[i+ny][j+nx] == '#' && !b[i][j])
                    b[i][j] = true;
        }
    }

    rep(i, h)rep(j, w){
        if(s[i][j] == '#' && !b[i][j]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#define N 2000001
int main()
{
  int n,A[N],i,j,B[N],count,C[N],D[N],a,max=0;
  scanf("%d",&n);
  for(i=1;i<=n;i++)
    {
      scanf("%d",&A[i]);
      if(max<A[i])
	max=A[i];
    }
  for(i=0;i<=max;i++)
    {
      C[i]=0;
    }
  for(j=1;j<=n;j++)
    C[A[j]]++;
  //for(i=0;i<=max;i++)
  //  printf("%d ",B[i]);
  //printf("\n");
  for(i=0;i<=max;i++)
    {
      C[i]=C[i-1]+C[i];
    }
  //for(i=0;i<=max;i++)
  //  printf("%d ",C[i]);
  //printf("\n"); 
  for(j=n;j>=1;j--)
    {
      B[C[A[j]]]=A[j];
      C[A[j]]--;
    }
  for(i=1;i<=n;i++)
    {
      printf("%d",B[i]);
      if(i!=n)
	printf(" ");
    }
  printf("\n");
  return 0;
}



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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;

  ll ans = 0;
  REP(i,1000){
    bool failure = false;
    ll index = 0;
    ll d1 = i/100;
    FOR(j,index,n){
      ll c = s[j]-'0';
      if(c==d1){
        index = j+1;
        break;
      }
      if(j==n-1) index = n;
    }
    ll d2 = (i%100)/10;
    FOR(j,index,n){
      ll c = s[j]-'0';
      if(c==d2){
        index = j+1;
        break;
      }
      if(j==n-1) index = n;
    }
    ll d3 = i%10;
    FOR(j,index,n){
      ll c = s[j]-'0';
      if(c==d3){
        break;
      }
      if(j==n-1) index = n;
    }

    if(index<n)ans++;
  }
  
  //cout << fixed << setprecision(10);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, X;
	cin >> N >> X;
	int L[100];
	rep(i, N) cin >> L[i];

	int kotae = 1;
	int kei = 0;
	rep(i, N) {
		kei += L[i];
		if (kei <= X) kotae++;
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int H,W,a,b,c;
	/*??¨???????????????*/
	while(1){
	scanf("%d %d",&H,&W);
	if(H==0 && W==0){break;}
	/*????????????#*/
	for(a=1;a<=W;a++){
	printf("#");
	}
	printf("\n");
	/*???????????\???*/
	if(W==1){
	for(b=1;b<=H-2;b++){
	printf("#\n");
	}
	}
	for(b=1;b<=H-2;b++){
	printf("#");
	for(c=1;c<=W-2;c++){
	printf(".");
	}
	printf("#\n");
	}
	for(a=1;a<=W;a++){
	printf("#");
	}
	printf("\n");
	printf("\n");
	}
return 0;
}

Measured memory_bytes: 588
/*
Author : Hocky Yudhiono
5/30/2020 7:07:09 PM

1. You can sort the query if offline!
2. Don't bring the dp remaining state when dfsing on DP on Tree.
3. Try to reverse (Think from the back) if you stuck.
4. Be careful when submitting Div. 2 D-F, dont waste it on stupid WAs.
5. Try to reduce a problem
*/

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef vector<int> vi;
typedef pair<LL,LL> PLL;
typedef pair<LL,int> PLI;
typedef pair<int,int> PII;
typedef pair<int,int> pii;
typedef vector<vector<LL>> VVL;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define popf pop_front
#define pf push_front
#define popb pop_back
#define mp make_pair
#define pb push_back
#define remove erase
#define fi first
#define se second

//If the time limit is strict, try not to use long double

//Remember to undefine if the problem is interactive
#define endl '\n'
#define DEBUG(X) cout << ">>> DEBUG(" << __LINE__ << ") " << #X << " = " << (X) << endl

const double EPS = 1e-9;
const int INFMEM = 63;
const int INF = 1061109567;
const LL LINF = 4557430888798830399LL;
const double DINF = numeric_limits<double>::infinity();
const LL MOD = 1000000007;
const int dx[8] = {0,0,1,-1,1,-1,1,-1};
const int dy[8] = {1,-1,0,0,1,-1,-1,1};
// Do dir^1 to get reverse direction
const char dch[4] = {'R','L','D','U'};
// const string ds[8] = {"E","W","S","N","SE","NW","SW","NE"};
const double PI = 3.141592653589793;

inline void open(string a){
    freopen((a+".in").c_str(),"r",stdin);
    freopen((a+".out").c_str(),"w",stdout);
}

inline void fasterios(){
    //Do not use if interactive
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

string s;
int n;
LL memo[200005][2];

LL dp(LL pos,bool rem){
    if(pos == n) return 0;
    LL &ret = memo[pos][rem];
    if(ret != -1) return ret;
    if(s[pos] == 'D') return ret = dp(pos+1,0)+1+rem;
    if(s[pos] == 'P') return ret = dp(pos+1,1);
    return ret = max(dp(pos+1,0)+1+rem,dp(pos+1,1));
}

string ans;

void bt(LL pos,bool rem){
    if(pos == n) return;
    if(s[pos] == 'D'){
        ans += 'D';
        bt(pos+1,0);
        return;
    }
    if(s[pos] == 'P'){
        ans += 'P';
        bt(pos+1,1);
        return;
    }
    if(dp(pos,rem) == dp(pos+1,0)+1+rem){
        ans += 'D';
        bt(pos+1,0);
        return;
    }
    ans += 'P';
    bt(pos+1,1);
    return;
}

int main(){
  fasterios();
    memset(memo,-1,sizeof(memo));
    cin >> s; n = s.length();
    dp(0,0);
    bt(0,0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 16288
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
int d[20];
bool check(int x){
	while(x){
		if(d[x%10]) return false;
		x /= 10;
	}
	return true;
}
int main(){
	int n, k;
	cin>>n>>k;
	rep(i, k){
		int a;
		cin>>a;
		d[a] = 1;
	}
	while(!check(n)) n++;
	cout<<n<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for (int i = 1; i <= n; i++) {
			int x = i;
			int total = 0;
			while (x != 0) {
				total += x % 10;
				x /= 10;
			}
			if (total >= a && total <= b) {
				count += i;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 21844
def solve(string):
    N, M, X, Y, *xy = map(int, string.split())
    x, y = xy[:N], xy[N:]
    max_x = max(x)
    min_y = min(y)
    if min_y <= max_x or min_y <= X or Y <= max_x:
        return "War"
    else:
        return "No War"


if __name__ == '__main__':
    print(solve("\n".join([input(), input(), input()])))


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

int main(){
	ll n;
	ll a,b;
	ll r=0,k=0;
	ll ans=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		if(r<a){
			r=a;
			k=b;
		}
	}
	cout<<r+k<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main() {
    int N,K;
    string S, ans;
    cin >> N >> S >> K;

    char c = S.at(K-1);

    ans = "";

    for(int i=0; i < S.size(); i++) {
        if(S.at(i) != c) {
            ans += "*";
        } else {
            ans += c;
        }
    }

    cout << ans << endl;

    return 0;
}

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

long n, m, a[100010], dp[100010];
int j;

int main(){
	cin >> n >> m;
	for (int i = 0; i < m; ++i) cin >> a[i];
	dp[0] = 1;
	dp[1] = (a[0] == 1) ? 0 : 1;
	j = (a[0] == 1) ? 1: 0;
	for (int i = 2; i <= n; ++i){
		if (a[j] == i){
			dp[i] = 0;
			j++;
		}
		else{
			dp[i] = (dp[i-1] + dp[i-2]) % MOD;
		}
	}
	cout << dp[n];
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n;
	cin >> n;
	int m = n;
	int temp = 0;
	while(m!=0){
		temp += m%10;
		m = (m-m%10)/10;
	}
	if(n%temp==0)  cout << "Yes" << endl;
	else cout << "No" << endl;
	return;
}

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

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int x;
    cin >> x;
    cout << 10 - x / 200 << endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
void Merge(int s[],int l,int r);
int temp[1000000];
int c=0;
int main(){
  int n,i,j,l,m,r,q;
  int a[1000000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  Merge(a,0,n-1);
  for(i=0;i<n-1;i++){
    printf("%d ",a[i]);
  }
  printf("%d\n",a[n-1]);
  printf("%d\n",c);
  return 0;
}
void Merge(int x[],int left,int right){
  int mid,i,j,k;
  if(left>=right){
    return;
  }
  mid=(left+right)/2;
  Merge(x, left, mid);
  Merge(x, mid + 1, right);
  for (i = left; i <= mid; i++){
    temp[i] = x[i];
  }

  for (i = mid + 1, j = right; i <= right; i++, j--){
    temp[i] = x[j];
  }

  i = left;
  j = right;

  for (k = left; k <= right; k++){
    if (temp[i] <= temp[j]){
        x[k] = temp[i++];
        c++;
      }
    else{
        x[k] = temp[j--];
        c++;
      }
    }
}



Measured memory_bytes: 5672
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cstring>
#include <queue>
#include <cstdio>
#include <cmath>
#include <sstream>
 
using namespace std;
 
typedef long long Long;

typedef vector<int> VI;
typedef vector<VI> VVI;



int main(int argc, char *argv[]) {
	int N;
	cin >> N;
	vector<int> V(N);
	for (int &v : V) {
		cin >> v;
	}
	Long moves = 0;
	for (int i = 0; i < N && moves >= 0; ++i) {
		if (i == 0) {
			if (V[i] != 0) moves = -1;
		} else {
			if (V[i] > V[i-1]+1) {
				moves = -1;
			} else if (V[i] == V[i-1]+1) {
				moves++;
			} else {
				moves += V[i];
			}
		}
	}
	cout << moves << endl;
}

 


Measured memory_bytes: 1152