akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll a,b;
cin>>a>>b;
if((b-1)%(a-1)>0){
    cout<<(b-1)/(a-1)+1<<endl;
}else{
    cout<<(b-1)/(a-1)<<endl;
}
}










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

if n>0:
    p = list(map(int, input().split()))
else:
    print(x)
    exit()

if x not in p:
    print(x)
    exit()


ans1=ans2=101
flag=0


for i in range(1,len(p)+1):


    if x+i not in p:
        ans1=x+i
        flag=1
    if x-i not in p:
        ans2=x-i
        flag=1
    if flag==1:
        break


# print(ans1,ans2)
print(min(ans1,ans2))



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

using namespace std;

int main(void) {
  int N, a, b;
  cin >> N >> a >> b;
  
  while(a <= b) {
    if (a % N == 0) {
      cout << "OK" << endl;
      return 0;
    }
    a++;
  }
  
  cout << "NG" << endl;
  

  return 0;
}

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

using namespace std;

int main(){
  
  //freopen("input.txt","r",stdin);
  //freopen("outputu.txt","w",stdout);
  long long n,m,i,j,k,s(0);
  cin>>n>>k;
  long long arr[n];
  for(i=0;i<n;i++)cin>>arr[i];
  sort(arr,arr+n,greater<int>());
  for(i=k;i<n;i++)s+=arr[i];
  cout<<s;

  
  


  
 
 
 
    
 
return 0;
}

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

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)

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


struct String{
	string s;
	String(string a) : s(a){};
	String(){};
	friend bool operator<(const String& l, const String& r){
		if (l.s.length() != r.s.length()) return l.s.length() < r.s.length();
		else return l.s < r.s;
	}
};

signed main(){

	int N, M;
	cin >> N >> M;
	int a[10], m[10] = { INF, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
	String dp[12345];
	for (int i = 0; i < M; i++){
		cin >> a[i];
		dp[m[a[i]]] = max(dp[m[a[i]]], String(string(1,'0'+a[i])) );
	}

	for (int n = 0; n <= N; n++){
		for (int i = 0; i < M; i++){
			if (!dp[n].s.empty())
				dp[n + m[a[i]]] = max(dp[n + m[a[i]]], String(dp[n].s + string(1, ('0' + a[i]))));
		}
	}

	cout << dp[N].s << endl;




	return 0;
}

Measured memory_bytes: 33024
import java.io.*;
import java.util.*;
class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static int[] arr,sp;
	static int maxn=(int)(1e3)+3;
	static Map<Integer,Integer> m1=new HashMap<>();
	static long mod=(long)(1e9+7);
	
	static void mark(int num)
	{
		int i=2,elem;
		while((elem=(num*i))<maxn)
		{
			arr[elem]=1;i++;sp[elem]=num;
		}
	}
	
	static void build()
	{
		arr=new int[maxn];sp=new int[maxn];
		for(int i=2;i<maxn;i++)
		{
			if(arr[i]==0)
			{
				sp[i]=i;mark(i);
			}
		}
	}
	
	static void put(int idx,int val)
	{
		if(m1.get(idx)==null)	
		{
			m1.put(idx,val);
		}
		else
		{
			m1.put(idx,m1.get(idx)+val);
		}
	}
	
    public static void main(String args[]) throws Exception
    {
		build();int n=sc.nextInt();
		if(n==1)
		{
			out.println(1);
		}
		else
		{
			for(int i=2;i<=n;i++)
			{
				int curr=i;
				while(curr>1)
				{
					put(sp[curr],1);curr/=sp[curr];
				}
			}
			long res=1;
			for(Map.Entry<Integer,Integer> en:m1.entrySet())
			{
				long now=en.getValue()+1;
				res=(res*now)%mod;
			}
			out.println(res);
		}
		out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

Measured memory_bytes: 8276
#include<stdio.h>
#include<math.h>
#define EPS 1e-10

int main(void){
  double x[4];
  double y[4];
  int i;
  double v[2][2];

  while(scanf("%lf %lf ",&x[0],&y[0])!=EOF){

    for(i=1;i<4;i++)scanf("%lf %lf ",&x[i],&y[i]);

    v[0][0] = x[0] - x[1];
    v[0][1] = y[0] - y[1];
    v[1][0] = x[2] - x[3];
    v[1][1] = y[2] - y[3];

    if( fabs(v[0][0] * v[1][0] + v[0][1] * v[1][1]) < EPS)printf("YES\n");
    else printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 0
/**
*    author:  souzai32
*    created: 13.08.2020 17:43:53
**/

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {

    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    int x,y;
    x=abs(sx-tx); y=abs(sy-ty);

    bool ud=tx<sx,lr=ty<sy;
    string a="UD",b="RL";

    rep(i,x) cout << b.at(lr);
    rep(i,y) cout << a.at(ud);
    rep(i,x) cout << b.at(!lr);
    rep(i,y) cout << a.at(!ud);
    cout << b.at(!lr);
    rep(i,y+1) cout << a.at(ud);
    rep(i,x+1) cout << b.at(lr);
    cout << a.at(!ud);
    cout << b.at(lr);
    rep(i,y+1) cout << a.at(!ud);
    rep(i,x+1) cout << b.at(!lr);
    cout << a.at(ud);

    
    return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<string>

using namespace std;

int main(){
    string str;

    while (cin >> str)
    {
        for (int i = str.length() - 1; i >= 0;i--) {
            cout << str[i];
        }

            cout<< endl;
    }
    
    return 0;
}

Measured memory_bytes: 1176
import math.{max,min}
import io.StdIn._
object Main extends App {
    val Array(n, t) = readLine.split(" ").map(_.toInt)
    val ts = readLine.split(" ").map(_.toInt)

    val sa = ts.sliding(2).map(arr => max(0, arr.last-(arr.head+t)))
    println(ts.last+t-sa.sum)
}

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


string S;

long long int rec (int i,long long int sum,long long int num) {

    if( i == S.size() ) return  num ? 0 : sum ;

    num = num * 10 + (S[i] - '0');

    return rec(i + 1, sum + num, 0) + rec(i + 1, sum, num);
}

int main (){
    cin >> S;
    cout << rec(0,0,0) << endl;
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, M, N, D, K, L, Q, W, H, T, X, Y, S;

int main()
{
    string str; cin >> str;
    if (str.substr(0, 4) == string("YAKI"))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let s: Vec<_> = read::<String>().chars().collect();
    if s[0] != 'A' {
        println!("WA");
        return;
    };
    let mut cnt = 0;
    for i in 1..s.len() {
        if s[i].is_uppercase() {
            if i == 1 || i == s.len() - 1 || s[i] != 'C' {
                println!("WA");
                return;
            }
            cnt += 1
        }
    }
    if cnt != 1 {
        println!("WA");
        return;
    }
    println!("AC");
}

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


Measured memory_bytes: 4352
time=1
n=int(input())

A=[[] for i in range(n)]
d=[0 for i in range(n)]
f=[0 for i in range(n)]

for i in range(n):
	a=list(map(int,input().split()))
	for j in range(a[1]):
		A[i].append(a[2+j]-1)

def dfs(q,num):
	global d,f,time
	d[num]=time
	for nx in q[num]:
		if d[nx]==0:
			time+=1
			dfs(q,nx)
	time+=1
	f[num]=time
	
for i in range(n):
	if d[i]==0:#unvisit
		dfs(A,i)
		time+=1

for i in range(n):
	print(i+1,d[i],f[i])


Measured memory_bytes: 5660
#include <iostream>
#include <queue>
#include <utility>

using namespace std;

int main() {
    int n;
    cin >> n;
    int q;
    cin >> q;
    queue<pair<string, int>> Q;
    for (int i=0; i<n; i++) {
        string name;
        cin >> name;
        int time;
        cin >> time;
        pair<string, int> target = make_pair(name, time);
        Q.push(target);
    }
    int time = 0;
    int count = 0;
    while(1) {
        pair<string, int> now = Q.front();
        if (now.second > q) {
            time += q;
            now.second -= q;
            pair<string, int> newnow = make_pair(now.first, now.second);
            Q.pop();
            Q.push(newnow);
        } else {
            time += now.second;
            cout << now.first << ' ' << time << endl;
            Q.pop();
            count++;
        }
        if(count >= n) break;
    }

}


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

int main() {
    string s, t;
    cin >> s >> t;

    string s_tmp = s;
    bool f;
    
    if(s.size() < t.size()){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    for (int i=s.size() - t.size(); i>=0 ; i--){
        if(s.at(i) != '?' && s.at(i) != t.at(0)){
            continue;
        }

        int count=0;
        f = false;
        for (int j=0; j<t.size(); j++){
            if(s.at(i+j) == t.at(j) || s.at(i+j) == '?') count++;
//            cout << "i, j=" << i << j << ' ' << count << ' ' << endl;
        }

        if(count == t.size()){
            for (int j=0; j<t.size(); j++){
                s_tmp.at(i+j) = t.at(j);
            }
            f = true;
            break;
        }

    }

    if(f){
        for(int i=0; i<s_tmp.size(); i++){
            if(s_tmp.at(i) == '?') cout << 'a';
            else cout << s_tmp.at(i);
        }
        cout << endl;
    }else{
        cout << "UNRESTORABLE" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
using System;

namespace B
{
	class Program
	{
		static void Main(string[] args)
		{
			string s = Console.ReadLine();
			string t = Console.ReadLine();

			int nCorrMax = 0;
			for (int i = 0; i < s.Length - t.Length + 1; i++)
			{
				var nCorrTmp = 0;
				var j = 0;
				foreach (var c in t)
				{
					if (c == s[i + j])
					{
						nCorrTmp += 1;
					}
					j++;
				}
				nCorrMax = Math.Max(nCorrMax, nCorrTmp);
			}

			Console.WriteLine(t.Length - nCorrMax);
		}
	}
}


Measured memory_bytes: 25860
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n,m;

int par[300000];
int urank[300000];
int size[300000];

void init(int n) {//初期化、引数は要素数
	for (int i = 0; i < n; i++) {
		par[i] = i;
		urank[i] = 0;
		size[i] = 1;
	}
}

int find(int x) {//木の根の添字
	if (par[x] == x) {
		return x;
	} else {
		return par[x] = find(par[x]);
	}
}

int get_size(int x) {//xを含む集合の要素数
	return size[find(x)];
}

void unite(int x, int y) {//xをyに併合
	x = find(x);
	y = find(y);
	if (x == y) return;

	int s = size[x] + size[y];
	if (urank[x] < urank[y]) {
		par[x] = y;
		size[y] = s;
	} else {
		par[y] = x;
		size[x] = s;
		if (urank[x] == urank[y]) urank[x]++;
	}
}

bool same(int x, int y) {//同じか判定
	return find(x) == find(y);
}

int main(){
	cin >> n >> m;
	init(n + m);

	REP(i,n) {
		ll k;
		cin >> k;
		REP(j,k) {
			ll l;
			cin >> l;
			l += n - 1;
			unite(i,l);
		}
	}

	REP(i,n - 1) {
		if(!same(i,i+1)) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}



Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define It iterator
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=100003;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}


string s;
int n=0;

int main(){
    cin>>s;
    rep(i,0,s.length()-1) if(s[i]!=s[i+1]) n++;
    cout<<n;

    return 0;
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
#define MAX 2000000

int H,A[MAX+1];

void maxHeapify(int id){
    int l,r;
    l = 2*id;
    r = 2*id+1;
    int largestid = id;
    if (l <= H & A[l] > A[id]){
        largestid = l;
    }
    if (r <= H & A[r] > A[largestid]){
        largestid = r;
    }
    if(largestid != id){
        int swap = A[id];
        A[id] = A[largestid];
        A[largestid] = swap;
        maxHeapify(largestid);
    }
}

void buildMaxHeap(int H){
    int i;
    for(i = H/2; i >= 1; i--){
        maxHeapify(i);
    }
}
int main(){
    int i;
    cin >> H;
    for(i = 1; i <= H; i++){
        cin >> A[i];
    }
    buildMaxHeap(H);
    for(i = 1; i <= H; i++){
        cout << " " << A[i];
    }
    cout << endl;
}


Measured memory_bytes: 5020
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, x, y;
    cin >> n;
    vector<vector<int>> arr;
    map<pair<int, int>, int> e;
    int mx = 0;
    for(int i = 0; i < n; i++) {
        cin >> x >> y;
        for(int j = 0; j < arr.size(); j++) {
            int dx = x - arr[j][0];
            int dy = y - arr[j][1];
            e[{dx, dy}] += 1;
            mx = max(mx, e[{dx, dy}]);
            e[{-dx, -dy}] += 1;
            mx = max(mx, e[{-dx, -dy}]);
        }
        arr.push_back({x, y});
    }
    cout << n - mx << endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<bool> s(N);
  char ch;
  for (int i = 0; i < N; ++i) {
    cin >> ch;
    s[i] = (ch == 'o');
  }
  vector<bool> r(N);
  bool find(false);
  for (int i = 0; i < 4; ++i) {
    r[0] = (i / 2 == 0);
    r[1] = (i % 2 == 0);
    for (int j = 2; j < N; ++j) {
      r[j] = (r[j-1] ^ s[j-1]) ? !r[j-2] : r[j-2];
    }
    if ((((r[N-1] ^ s[N-1]) ? !r[N-2] : r[N-2]) == r[0]) && ((r[0] ^ s[0]) ? !r[N-1] : r[N-1]) == r[1]) {
      find = true;
      break;
    }
  }
  if (find) {
    for (int i = 0; i < N; ++i) {
      cout << (r[i] ? 'S' : 'W');
    }
  } else {
    cout << -1;
  }
  cout << endl;
}


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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N,M,S;
const ll mod= 1e5;

int main() {
    int N, M, S;
    while(cin >> N >> M >> S, N) {
        vector<vector<int>> dp(N * N + 1, vector<int>(S + 1));
        dp[0][0] = 1;
        for(int i = 1; i <= N * N; ++i) {
            for(int j = 0; j <= S; ++j) {
                if(i <= j) {
                    dp[i][j] += dp[i][j - i] + dp[i - 1][j - i];
                }
                if(j - M - 1 >= 0) {
                    dp[i][j] -= dp[i - 1][j - M - 1];
                }
                dp[i][j] = (dp[i][j] + mod) % mod;
            }
        }
        cout << dp[N * N][S] << endl;
    }
}



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

using namespace std;

const int N = 123;

int n;

int a[N];

int main() {

	cin >> n;
	bool flag = true;
	for (int i = 0; i < n; i ++) {
		cin >> a[i];
		if (a[i] % 2 == 0) {
			if (a[i] % 3 != 0 && a[i] % 5 != 0) {
				flag = false;
			}
		}
	}
	cout << ((flag) ? "APPROVED\n" : "DENIED\n");
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
    #pragma comment(linker, "/stack:200000000")
    #pragma GCC optimize("Ofast")
    #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include<bits/stdc++.h>
    #define int long long
    # define mo 1000000007
    using namespace std;
    #define goku ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    signed main(){
        goku
       int k,x;
       cin>>k>>x;
       int z = 500*k;
       if(z>=x)
        cout<<"Yes";
       else
        cout<<"No";

       return 0;
    }


Measured memory_bytes: 256
from bisect import bisect_left
N=int(input())
S=input()
li=[[] for i in range(10)]
for i in range(N):
    n=int(S[i])
    li[n].append(i)
ans=0
for i in range(10**3):
    a=i//100
    b=(i-100*a)//10
    c=i-100*a-10*b
    tmpn=[0 for i in range(10)]
    if not li[a]:
        continue
    tmpi=li[a][0]
    #print(tmpi)
    tmpn[a]+=1
    if tmpn[b]>len(li[b])-1:
        continue
    indin=bisect_left(li[b],tmpi,tmpn[b],len(li[b]))
    if indin==len(li[b]):
        continue
    tmpi=li[b][indin]
    #print(tmpi)
    #tmpn[b]+=1
    tmpn[b]=indin+1
    #print(tmpn)
    if tmpn[c]>len(li[c])-1:
        continue
    indin=bisect_left(li[c],tmpi,tmpn[c],len(li[c]))
    #print("indin",indin)
    if indin!=len(li[c]):
        ans+=1
        #print(i)
print(ans)


Measured memory_bytes: 4456
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

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

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	ll rw = 100*a, rs = 0;
	for(int i = 0;a*100*i <= f;i++){
		for(int j = 0;a*100*i+b*100*j <= f;j++){
			ll water = a*100*i+b*100*j;
			ll sl = min((a*i+b*j)*e, f-water);;
			for(int k = 0;k*c <= sl;k++){
				ll sugar = c*k;
				sugar += (sl-sugar)/d*d;
				if(sugar < 0 || water+sugar > f || sugar > sl)
					continue;
				if(sugar*(rw+rs) > rs*(water+sugar)){
					rw = water;
					rs = sugar;
				}
			}
		}
	}
	cout << rs+rw << " " << rs << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;

struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

signed main()
{
   int n, x; cin >> n >> x;
   if (x == 1 || x == 2*n-1) {
      cout << "No" << endl;
      return 0;
   }

   V<int> ans;
   if (x < n) {
      for (int i = 2; i < n; i++) if (i != x) {
         ans.push_back(i);
      }
      ans.push_back(2*n-1);
      ans.push_back(1);
      ans.push_back(x);
      ans.push_back(2*n-2);
      for (int i = n; i < 2*n-2; i++) if (i != x) {
         ans.push_back(i);
      }
   } else {
      for (int i = 3; i < n; i++) if (i != x) {
         ans.push_back(i);
      }
      ans.push_back(1);
      ans.push_back(2*n-1);
      ans.push_back(x);
      ans.push_back(2);
      for (int i = n; i < 2*n-1; i++) if (i != x) {
         ans.push_back(i);
      }
   }
   if (ans.size() != 0) {
      cout << "Yes" << endl;
      for (int i = 0; i < 2*n-1; i++) {
         cout << ans[i] << " ";
      }
      cout << endl;
   } else {
      cout << "No" << endl;
   }

   return 0;
}


Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.0096_";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}

ll comb (int n, int r ){
	ll res = 1LL;
	rep (i, r ) res *= (ll)(n - i );
	rep (i, r ) res /= (ll)(r-i);

	return res;
}

int main()
{
//	cut here before submit 
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	ios_base::sync_with_stdio(0);
	int n;
	while (cin >> n ){
		ll res = 0LL;
		rep (i, 1<<4 ){
			int rems = n;
			int parity = 0;
			rep (j, 4 ) if (i & (1<<j ) ) rems -= (1000 + 1 ), parity++;
			if (rems < 0 ) continue;
			ll curr = comb (rems + 4 - 1, 4 - 1 );		
			res += (parity % 2 == 0 ? curr : -curr );
		} // end rep
		cout << res << endl;
	} // end while			

#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif			
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> b(n - 1);
    for (int i = 0; i < n - 1; i++)
        cin >> b[i];
    int ans = 0;

    ans += b[0];

    for (int i = 0; i < n - 2; i++)
    {
        ans += min(b[i], b[i + 1]);
    }

    ans += b[n - 2];

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
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; }
typedef long long ll;
typedef pair<int,int> P;

vector<pair<ll,int>> prime_factor(ll n) {
  vector<pair<ll,int>>res;
  for(ll i = 2; i * i <= n; i++) {
    if(n % i == 0) {
      int t = 1;
      n /= i;
      while(n%i==0){
        t++;
        n/=i;
      }
      res.push_back(pair<ll,int>(i,t));
    }
  }
  if(n != 1) res.push_back(pair<ll,int>(n,1));
  return res;
}

int main(){
    ll n;
    cin >> n;
    auto mp = prime_factor(n);
    ll ans = 0;
    int t = 1;
    // for(auto p:mp){
    //     for(int i=0;i*(i+1)/2<p.second;i++){
    //        t = i;
    //    }
    //    ans += t;
    // }
    for(auto p:mp){
        //cout << p.first << " " << p.second << endl;
        for(int i=0;i*(i+1)/2<=p.second;i++){
            t = i;
        }
        ans += t;
        t = 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
def CP(a,b):
	x = a[1]*b[2]-a[2]*b[1]
	y = a[2]*b[0]-a[0]*b[2]
	z = a[0]*b[1]-a[1]*b[0]
	return (x,y,z)

minus = lambda d:tuple(-i for i in d)

class dice:
	def __init__(self,data):
		names = [(1,0,0),(0,0,1),(0,1,0),(0,-1,0),(0,0,-1),(-1,0,0)]
		self.faces = {n:d for n,d in zip(names,data)}
		self.top = (1,0,0)
		self.north = (0,0,-1)
	
	def turn(self,direction):
		if direction == 'N':
			self.top,self.north = minus(self.north),self.top
		elif direction == 'S':
			[self.turn('N') for i in range(3)]
		elif direction == 'W':
			self.top = CP(self.top,self.north)
		elif direction == 'E':
			[self.turn('W') for i in range(3)]

if __name__ == '__main__':
	data = [int(i) for i in input().split()]
	operations = input()
	d = dice(data)
	[d.turn(o) for o in operations]
	print(d.faces[d.top])

Measured memory_bytes: 7800
function Main(input) {
  const arr = Array.from(input);
  const is7Included = arr.some(x => x === '7');

  if (is7Included) {
    console.log('Yes');
  } else {
    console.log('No');
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29532
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };



signed main() {
	int i, j, k;
	int n;

	cin >> n;

	if (n == 7 || n == 5 || n == 3) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}













	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
k = int(input())
data = [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(data[k-1])

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

signed main() {
  vector<int> dish(5);
  for( int i = 0; i < 5; i++ ) cin >> dish.at(i);
  sort(dish.begin(), dish.end());
  
  int sum;
  int ans = 100000; 
  do{
    sum = 0;
    for( int i = 0; i < 5; i++ ){
      sum += dish.at(i);
      if( i < 4 && dish.at(i) % 10 > 0 ){
        sum += 10 - ( dish.at(i) % 10 );
      }
    }
    if( sum < ans ) ans = sum;
  }while( next_permutation(dish.begin(), dish.end()) );
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll N, T; cin >> N >> T;
    ll res = 0;
    ll pre_t = 0;
    for(int i = 0; i  <N;i++){
        ll t; cin >> t;
        if(i == 0){
            pre_t = t;
            continue;
        }else{
            res += min(t- pre_t,T);
            pre_t = t;
        }
    }
    res += T;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int a[n+1],i,j,sum=100000000,temp;
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  for(i=-100;i<=100;i++){
    temp=0;
    for(j=0;j<n;j++)
      temp+=(i-a[j])*(i-a[j]);
    if(temp<sum)
      sum=temp;
  }
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 1728
w,h,n = map(int,input().split())

li = [list(map(int,input().split())) for _ in range(n)]

s1 = 0
s2 = w
t1 = 0
t2 = h

for i in range(n):
    if li[i][2] == 1:
        s1 = max(li[i][0],s1)
    if li[i][2] == 2:
        s2 = min(li[i][0],s2)
    if li[i][2] == 3:
        t1 = max(li[i][1],t1)
    if li[i][2] == 4:
        t2 = min(li[i][1],t2)

if s2-s1 < 0 or t2-t1 < 0:
    print(0)
    exit()
        
ans = (s2-s1) * (t2-t1)

print(ans if ans > 0 else 0)

Measured memory_bytes: 3064
//key2020_b.cpp
//Sat Feb 29 08:51:06 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;

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

	vector<P> pos;
	for (int i=0;i<n;i++){
		ll a,b;
		cin >> a >> b;
		pos.push_back(P(a+b,a-b));
	}

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

	ll ans = 1;
	ll prevend = pos[0].first;
	for (int i=0;i<pos.size();i++){
		if (prevend<=pos[i].second){
			ans++;
			prevend=pos[i].first;
		}
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 2420
from itertools import combinations as cmbs
import sys
c = {"M":0,"A":0,"R":0,"C":0,"H":0}
for i in range(int(input())):
  si = sys.stdin.readline()[0]
  if si in c:
    c[si] += 1
ans = sum(i*j*k for i,j,k in cmbs(c.values(),r=3))
print(ans)


Measured memory_bytes: 9184
module aoj;

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

int main(){
	int[] array = new int[10];

	for(int i = 0; i < 10; i++) {
		array[i] = to!int(chomp(readln()));
	}

	sort!((int e1, int e2){ return e1 > e2; })(array);

	for(int i = 0; i < 3; i++) {
		writeln(array[i]);
	}

 	return 0;
}

Measured memory_bytes: 1052
#include <bits/stdc++.h>
#define int long long 
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int n;
int res;

void dfs(int x){
    if(x > n) return;

    if(x > 0){
        set<int> s;
        int y = x;
        while(y > 0){
            s.insert(y % 10);
            y /= 10;
        }
        if(s.size() == 3) res++;
    }

    for(int d : {3, 5, 7}){
        int nx = 10 * x + d;
        dfs(nx);
    }
}

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

    cin >> n;

    dfs(0);

    cout << res << endl;

    return 0;
}


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

using namespace std;

#define LL long long
#define ULL unsigned LL
#define LD long double
#define debug(x) cerr << #x << " " << x << endl;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	LD r;
	cin>>r;
	LD w = 2.0 * M_PI * r;
	cout<<setprecision(10)<<fixed<<w;
}


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

int main(){
  int n;  cin >> n;
  vector<int> a(n);
  int cm = -1;
  int cnt = -1;
  rep(i,n){
    cin >> a[i];
    cm = max(cm, a[i]);
    if(cm == a[i])
      cnt = i;
  }
  sort(a.begin(), a.end());
  int cm2 = a[n-2];
  rep(i,n){
    if(i == cnt){
      cout << cm2 << endl;
    }
    else cout << cm << endl;
  }
  return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>
#include <math.h>
#include <iostream>
#include<string>
#include<vector>
#include <algorithm>
#define REP(a,b) for (int i = a; i <= (b); i++)
using namespace std;
int main() {
	int b, a, c;
	cin >> a >> b;
	REP(0, a) {
		if (a < 500) {
			break;
		}
		else if (a >= 500) {
			a = a - 500;
			if (a < 500) {
				break;
			}
		}
	}
	c = a - b;
	if (c <= 0) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll a,b;cin>>a>>b;
    if((a>0&&b>0)||(b-a)%2!=0){
        cout<<"Positive"<<endl;
        return 0;
    }else if(a<=0&&b>=0){
        cout<<"Zero"<<endl;
        return 0;
    }else{
        cout<<"Negative"<<endl;
        return 0;
    }
}

Measured memory_bytes: 256
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    cnt = 0
    for i in range(n):
        if i + 1 == a[a[i]-1]:
            cnt += 1
    print(cnt // 2)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 52976
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int H, W, K;
char c[6][6];

int count_black(int h, int w) {
	int cnt = 0;

	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			if (h & (1<<i)) continue;
			if (w & (1<<j)) continue;
			if (c[i][j] == '#') cnt++;
		}
	}

	return cnt;
}

int main() {
	cin >> H >> W >> K;

	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			cin >> c[i][j];
		}
	}

	int ans = 0;
	for (int h=0; h<(1<<H); h++) {
		for (int w=0; w<(1<<W); w++) {
			int cnt = 0;
			if (count_black(h, w) == K) ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

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

int main(void)
{
    ll x; cin>>x;
    ll ans;
    if(x>=1800) ans=1;
    else if(x>=1600) ans=2;
    else if(x>=1400) ans=3;
    else if(x>=1200) ans=4;
    else if(x>=1000) ans=5;
    else if(x>=800) ans=6;
    else if(x>=600) ans=7;
    else ans=8;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define N 2001
#define int long long
using namespace std;
vector<int>G[N];
int n,K,S;
struct point{int x,y,z;};

int Area(){return S*S*6;}
int sArea(point a,point b){
  int x = min(a.x+S, b.x+S), X = max(a.x, b.x);
  int y = min(a.y+S, b.y+S), Y = max(a.y, b.y);
  int z = min(a.z+S, b.z+S), Z = max(a.z, b.z);
  if(y <= Y || x <= X || z <= Z) return 0;
  int area=0;
  area += 2*(x-X)*(y-Y);
  area += 2*(y-Y)*(z-Z);
  area += 2*(z-Z)*(x-X);
  return area;
}

vector<point> A;
int dfs(int pos,int k,int start,int prev){
  if(prev!=-1 && pos==start) return 1LL<<55;
  if(k == K) return prev==-1||prev==start? 0:-sArea(A[pos],A[start]);
  
  int res = 1e9;
  for(int nx:G[pos]){
    if(nx == prev)continue;
    int area = Area() - sArea(A[pos],A[nx]);
    res = min(res,area+dfs(nx,k+1,start,pos));
  }
  return res;
}

signed main(){
  while(1){
    cin>>n>>K>>S;
    if(!n&&!K&&!S)break;
    
    A.resize(n);
    for(int i=0;i<n;i++)cin>>A[i].x>>A[i].y>>A[i].z;
    for(int i=0;i<N;i++) G[i].clear();

    for(int i=0;i<n;i++)
      for(int j=i+1;j<n;j++){
	if(!sArea(A[i],A[j]))continue;
	G[i].push_back(j);
	G[j].push_back(i);
      }

    int ans = 1e9;
    for(int i=0;i<n;i++)ans = min(ans,Area()+dfs(i,1,i,-1));
    if(ans == 1e9) ans = -1;
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 3152
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;
typedef tuple<int, int, string> Edge;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m, s, g;
    while (cin >> n >> m >> s >> g, n) {
        vector<Edge> edge(m);
        REP(i, 0, m) {
            int x, y;
            string lab;
            cin >> x >> y >> lab;
            edge[i] = make_tuple(x, y, lab);
        }
        vector<string> cost(n, "~");
        cost[g] = "";
        bool check = true;
        REP(i, 0, 7 * n) {
            for (auto &e : edge) {
                int x, y;
                string lab;
                tie(x, y, lab) = e;
                if (cost[y] == "~") continue;
                string nxt = lab + cost[y];
                if (cost[x] > nxt) {
                    if (x == s && i >= n - 1) {
                        check = false;
                    }
                    cost[x] = nxt;
                }
            }
        }
        check &= (cost[s] != "~");
        cout << (check ? cost[s] : "NO") << endl;
    }
}



Measured memory_bytes: 3504
#include <cstdio>
#include <utility>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

void debug_print_ints(int* as, int n){
  printf("%d\n", n);
  for(int i=0; i < n; i++){
    printf("%d, ", as[i]);
  }
  printf("\n");
}

int ourmod(int a, int b){
  if(a >= 0){
    return a%b;
  }else{
    return (a + ((-a)/b+1)*b)%b;
  }
}

int div_up(int a, int b){
  if(a%b == 0){
    return a/b;
  }else{
    return a/b + 1;
  }
}

int N, K;

int main(){
  scanf("%d %d", &N, &K);

  unsigned long long res = 0;
  for(int a=1; a <= N; a++){
    if((2*a) % K == 0){
      long possible = N/K;
      int m = -a;

      possible = ((N - m)/K) - div_up(1 - m, K) + 1;
      
      res += possible*possible;
    }
  }

  printf("%lld\n", res);
  
  return 0;
}
  


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		
		// ??\???
		Scanner scan = new Scanner(System.in);
		scan.useDelimiter("\\r\\n");
		
		// ??????
		int count[];
		count = new int[26];
		while(scan.hasNext()) {
			String S = scan.nextLine();
			// ???????????????
			int sl = S.length();
			// ?°???????????????????
			String s = S.toLowerCase();
			// 1????????\???char??????????´?
			char[] charArray = s.toCharArray();
			for (char ch : charArray) {
				int CH = ch;
				// a-z?????°??????
				if(((CH-97)>=0) && ((CH-97)<26)){
					count[CH-97]++;
				}
			}
		}
		// ??????
		for (int i=0; i<26; i++) {
			int cords = i + 97;
			char c = (char)cords;
			System.out.println(c + " : " + count[i]);
		}

		
	}

}

Measured memory_bytes: 26052
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int count = 0;
	string input;

	while ( cin >> input )
	{
		string rev = input;
		reverse( rev.begin(), rev.end() );

		if ( input == rev )
		{
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1e18;

signed main(){
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    while(n!=0){
        n/=k;
        ans++;
    }
    cout<<ans<<endl;
}

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

int main(){
	int n, k;
  	cin >> n >> k;
  	vector<ll> a(n);
  	rep(i, n){
    	cin >> a[i];
    }

  	rep(i, n-k){
    	if(a[i]	< a[i+k]) cout << "Yes" << endl;
      	else cout << "No" << endl;
    }

}

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

// long int dp[101][100001];
#define INF 1000000000000000007
long long int dp[405][405];
int main() {
	int n,k;
	cin>>n;
	int arr[n];
	int i=0;
	for(i=0;i<n;i++)
	cin>>arr[i];
	int j;
	
	for(i=n-1;i>=0;i--)
	{
	    for(j=i;j<n;j++)
	    {
	        if(i==j)
	        dp[i][j]=0;
	        else
	        {
	            dp[i][j]=INF;
	           long long int s=0;
	            for(k=i;k<j+1;k++)
	            s+=arr[k];
	            for(k=i;k<j;k++)
	            dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+s);
	        }
	    }
	}
	cout<<dp[0][n-1];
	return 0;
	
}


Measured memory_bytes: 1536