akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  char a;
  cin >> a;
  
  if(a=='a'||a=='e'||a=='i'||a=='u'||a=='o'){
    cout << "vowel" <<endl;
  }
  else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
//58
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int a,b,c;cin>>a>>b>>c,a|b|c;){
    int n;
    cin>>n;
    int ch[1000][4];
    for(int i=0;i<n;i++){
      cin>>ch[i][0]>>ch[i][1]>>ch[i][2]>>ch[i][3];
    }
    int p[301];
    fill_n(p,301,2);
    for(int i=0;i<n;i++){
      if(ch[i][3]){
	p[ch[i][0]]=p[ch[i][1]]=p[ch[i][2]]=1;
      }
    }
    for(int i=0;i<n;i++){
      if(ch[i][3]==0){
	for(int j=0;j<3;j++){
	  if(p[ch[i][j]]==1&&p[ch[i][(j+1)%3]]==1){
	    p[ch[i][(j+2)%3]]=0;
	  }
	}
      }
    }
    for(int i=1;i<=a+b+c;i++){
      cout<<p[i]<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s
 
typedef long long ll;
 
using namespace std;

ll modd = 998244353;

template<class T>
T fastpower(T a, long long n) {  // n must be >= 1
  if (n % 2 == 0) {  
      T halfpower = fastpower<T>(a, n/2);
      return (halfpower*halfpower) % modd;
  } else {
      if (n == 1) {  return a; } else {  
          T halfpower = fastpower<T>(a, n/2);
          return (((halfpower*halfpower)%modd)*a)%modd;
      }
  }
};

 
int main()   {

    ios_base::sync_with_stdio(false);

    cout.precision(17);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, 1000);   // rand_gen(rng) gets the rand no
 
//    auto start = chrono::steady_clock::now();
 
//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readint(n);
        vector<pair<int,int>> b;
        vector<int> a;
        forr(i,0,n) {
            readint(kk); a.push_back(kk);
        }
        forr(i,0,n) {
            readint(kk); b.push_back(make_pair(kk, a[i]));
        }
        sort(b.begin(), b.end());
        vector<pair<int,int>> a_;
        forr(i,0,n) {
            a_.push_back(make_pair(b[i].second, i));
        }
        sort(a_.begin(), a_.end());

        bool is_ok = true;
        forr(i,0,n) {
            is_ok = is_ok && (a_[i].first<=b[i].first);
        }
        if (!is_ok) {cout << "No" << endl; continue;}

        int curr = 0;
        int ct = 1;
        while (a_[curr].second>0) {
            curr = a_[curr].second; ct++;
        }
        if (ct < n) {
            cout << "Yes" << endl; continue;
        }

        bool possible = false;
        forr(i,0,n-1) {
            possible = (a_[i+1].first<=b[i].first);
            if (possible) {break;}
        }
        if (possible) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }

    }
 
//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;
 
    return 0;
}

Measured memory_bytes: 5916
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt int

// x文字目の時に，あまりiである数をカウント
var dp = [13]int{}

func main() {
	var S string
	fmt.Scan(&S)
	// 1234 % mod = ((1000%mod) + (200%mod) + (30%mod) + (4%mod))%mod

	dp[0] = 1
	for i := 0; i < len(S); i++ {
		var nextdp = [13]int{}
		num, _ := strconv.Atoi(string(S[i]))

		for j := 0; j < 13; j++ {
			for k := 0; k < 10; k++ {
				if string(S[i]) == "?" || num == k {
					nextdp[((j*10)+k)%13] += dp[j]
					nextdp[((j*10)+k)%13] %= mod
				}
			}
		}
		dp = nextdp
	}
	fmt.Println(dp[5])
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy [][]int

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

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 5504
#include<stdio.h>
int main(){
int h,w,a[110][110],i,j,k;
char s;
scanf("%d %d\n",&h,&w);
for(i=0;i<h;i++){
for(j=0;j<w;j++){
scanf("%c",&s);
if(s=='.'){
a[i][j]=0;
}
else{
a[i][j]=1;
}
}
scanf("\n");
}
for(i=0;i<h;i++){
for(j=0;j<w;j++){
for(k=j;k>=0;k--){
if(a[i][k]==1){
break;
}
}
if(j!=0){
printf(" ");
}
if(k<0){
printf("-1");
}
else{
printf("%d",j-k);
}
}
printf("\n");
}
return 0;
}


Measured memory_bytes: 2076
#include<iostream>

using namespace std;

int digits(int s){ int cnt = 0;
  while( s > 0){
    cnt += s % 10;
    s /= 10;}
                   return cnt;}


int main(){
  int N; cin >> N;
   int sum = digits(N);
  if( N % sum == 0){cout << "Yes" << endl;}
  else{cout << "No" << endl;}
  
  return 0;}

Measured memory_bytes: 256
import java.util.*;
import java.util.Arrays;
public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k=0;
        for(int i=1;i<=9;i++){
            for(int j=1;j<=9;j++){
                if(n==i*j){
                    k=1;
                }
            }
        }
        if(k==1){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
        


    }
}

Measured memory_bytes: 23764
//g++でビルド

#include "bits/stdc++.h"

using namespace std;

int n;
double dp[3010][3010];
double ps[3000];

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

    for(int i = 0; i < n+2; i++){
        for(int j = 0; j < n+2; j++){
            dp[i][j] = 0;
        }
    }

    for(int i = 1; i < n+2; i++){
        for(int j = 1; j < n+2; j++){
            if(i == 1 && j == 1){
                dp[1][1] = 1;
            }else if(i + j <= n + 2){
                dp[i][j] = dp[i-1][j] * ps[i+j-3] + dp[i][j-1] * (1 - ps[i+j-3]);
            }
        }
    }

    for(int i = 0; i < n+2; i++){
        for(int j = 0; j < n+2; j++){
         //   cout << dp[i][j] << " ";
        }
       // cout << endl;
    }

    double result = 0;
    for(int i = 0; i <= (n-1)/2; i++){
        int j = n-i;
        result += dp[j+1][i+1];
    }
    cout<<fixed<<setprecision(10);
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 70784
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main(void) {
    
    int H, W; cin >> H >> W;
    char a[H+2][W+2];

    for (int h = 1; h <= H; ++h) {
        for (int w = 1; w <= W; ++w) cin >> a[h][w];
    }
    
    rep(h,H+2) {
        rep(w,W+2) {
            if (h == 0 || h == H + 1 || w == 0 || w == W + 1) {
                cout << "#";
            }
            else {
                cout << a[h][w];
            }
        }
        cout << endl;
    }

    
    return 0;
}






Measured memory_bytes: 256
n = int(input())
s = [input() for _ in range(n)]
abc = list("abcdefghijklmnopqrstuvwxyz")
ans = ""
for i in range(26):
	cnt = 10*8
	for j in range(n):
		cnt = min(cnt, s[j].count(abc[i]))
	ans += abc[i]*cnt
print(ans)

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

int main(){
    int w, a, b;
    cin>>w>>a>>b;
    if(abs(a-b)<=w){
        cout<<"0"<<endl;
    }
    else{
        cout<<abs(a-b)-w<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
N, X = map(int, input().split())
a = [1]
p = [1]
for i in range(N):
	a.append(a[i]*2+3)
	p.append(p[i]*2+1)

def f(N, X):
	if N == 0:
		return 0 if X <= 0 else 1
	elif X <= a[N-1]+1:
		return f(N-1, X-1)
	elif X == a[N-1]+2:
		return p[N-1] + 1
	elif a[N-1]+3 <= X <= 2*a[N-1]+2:
		return f(N-1, X-2-a[N-1]) + p[N-1] + 1
	else:
		return p[N]

print(f(N, X))


Measured memory_bytes: 3064
#!/usr/bin/perl
use Data::Dumper;
my ($n,$m) = map {$_ - 0} split(/\s+/o,<STDIN>);

my @tr = ();
$#tr = $n-1;

my @par = ();
$#par = $n-1;

for(my $i=0;$i<$n;$i++){
  $par[$i] = $i;
}

for(my $i=0;$i<$m;$i++){
  my ($a1,$b1) = map {$_ - 1} split(/\s+/o,<STDIN>);
  unite($a1,$b1);
}

my %dum = ();
for(my $i=0;$i<$n;$i++){
  $dum{&root($i)} = 1;
}
my @d2 = keys %dum;
my $res = @d2 - 1;
print "$res\n";

exit(0);

sub root {
  my $x = shift;
  return $x if $par[$x] == $x;
  my $r = &root($par[$x]);
  $par[$x] = $r;
  return $r;
}

sub unite {
  my $x = shift;
  my $y = shift;
  my $rx = &root($x);
  my $ry = &root($y);
  return if( $rx == $ry );
  $par[$rx] = $ry;
}


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

int main() {
    int n, i;
    cin >> n;
    
    for (i = 1; i <= n; i++) {
        int x = i;
        if (i % 3 == 0) {
            cout <<" "<< i;
            continue;
        }
        
        while(x) {
            if (x % 10 == 3) {
                cout <<" "<< i;
                break;   
            }
            x /= 10;
        }
    }
    cout << endl;
    return 0;
    
}



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

#define ll long long


int main()
{
    int n,m;
    cin>>n;
   m=n%10;


    if(m==2 || m==4 || m==5 || m==7 || m==9)cout<<"hon"<<endl;
    else if(m==0 || m==1 || m==6 || m==8)cout<<"pon"<<endl;
    else cout<<"bon"<<endl;
}


Measured memory_bytes: 3600
import java.util.Scanner;
public class Main {
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long K=sc.nextLong();
		long A=sc.nextLong();
		long B=sc.nextLong();
		for(int i=(int) A;i<=B;i++) {
			if(i%K==0) {
				System.out.println("OK");
				System.exit(0);
			}
		}
		System.out.println("NG");

		}
}


Measured memory_bytes: 35920
//117B
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
int main(void){
    int n =0, extra=0;
    cin >> n;
    vector<int>L(n,0);
    rep(i, n) cin >> L[i];
    sort(L.begin(), L.end());
    rep(i, n-1) extra+=L[i];
    if(L.back()< extra){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;
    ll n,k;
    cin >> n >> k;
    ll h[n];
    F0R(i,n) {
        cin >> h[i];
    }
    sort(h,h+n);
    ll mn = INF;
    FOR(i,0,n-k+1){
      if(h[i+k-1] - h[i] < mn) mn = h[i+k-1] - h[i];
    }
    cout << mn << endl;


    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define PI 3.141592653589793238462643383279


void change(int *x, int *y){
	int z;
	z = *x;
	*x = *y;
	*y = z;
}
int compare_int(const void *a, const void *b){
	return *(int*)a - *(int*)b;
}
int gcd(int a, int b)
{
    int c;
    if (a < b) {
        a+=b; b=a-b; a-=b;
    }
    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

int main(void){
	int n;
	int x[101], y[101], h[101];
	int cx, cy, H=-1;
	int flag;
	scanf("%d", &n );
	for(int i=0;i<n;i++)	scanf("%d %d %d", &x[i], &y[i], &h[i]);
	
	for(int i=0;i<=100;i++){
		for(int j=0;j<=100;j++){
			H=-1;
			flag = 1;
			for(int k=0;k<n;k++){
				if(h[k]==0)	continue;
				else{
					H = h[k] + abs(i-x[k]) + abs(j-y[k]);
					break;
				}
			}
			for(int k=0;k<n;k++){
				if( (h[k]!=0 && H != h[k] + abs(i-x[k]) + abs(j-y[k]) ) || (h[k]==0 && H > abs(i-x[k]) + abs(j - y[k]))  ){
					flag=0;
					break;
				}
			}
			if(flag==1){
				printf("%d %d %d", i,j,H);
				return 0;
			}
			
		}
	}
					
	return 0;
}


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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int res = 1000000;
    res = min(res, abs(a+b-c-d));
    res = min(res, abs(a+c-b-d));
    res = min(res, abs(a+d-b-c));
    cout << res << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){//yがいくつ集まったらx以上になるか
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

//a,b x
int main(){
	string s; cin>>s;
	rep(i,s.sz){
		if(s[i]==',') s[i]=' ';
	}
	cout<<s;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);

// #ifndef ONLINE_JUDGE
// 	freopen("input.txt" , "r" , stdin);
// 	freopen("output.txt" , "w" , stdout);
// #endif

	ll a, b, c, k, ans = 0;
	cin >> a >> b >> c >> k;
	if (a <= k)
	{
		ans += a;
		k -= a;
	}
	else
	{
		ans += k;
		k = 0;

	}

	if (b <= k)
	{
		k -= b;
	}
	else
	{
		k = 0;

	}

	if (c <= k)
	{
		ans -= c;
		k -= c;
	}
	else if (k > 0)
	{
		ans -= k;
		k = 0;

	}
	cout << ans << endl;



}


Measured memory_bytes: 3612
extern crate core;

use std::io::{self, Read};
use std::cmp::{max, min};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input.trim().to_string());
    println!("{}", output);
}

fn run(input: String) -> String {
    let list = input
        .split_whitespace()
        .map(|x| x.parse::<i64>().unwrap())
        .collect::<Vec<_>>();
    let n = list[0];
    let k = list[1];
    let mut sum = 0;
    //bの座標
    for i in 1..n + 1 {
        //i:周期
        //p:何周
        //q:余りの周、余りの最大値
        let p = n / i;
        let q = n % i;

        //1周にk以上が何個あるか
        let c = max(0, i - k);

        //余り(1〜q)にk以上が何個あるか
        let c2 = if k == 0 { q } else { max(0, q - k + 1) };

        sum += p * c + c2;
    }
    sum.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!(super::run($input.to_string()), $output.to_string());
                }
            )*
        }
    }
}

tests! {
    test1: "5 2" => "7",
    test2:"10 0"=>"100",
    test3:"31415 9265"=>"287927211",
}


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

using namespace std;

int main() {
	long long n;
	
	scanf("%lld", &n);
	
	long long res = 0;
	
	int v = sqrt(n);
	
	for (int i = 1; i <= v; i++) {
		if (n % i == 0) {
			long long a = i;
			long long b = n / i;
			if (a < b - 1) res += b - 1;
		}
	}
	
	printf("%lld\n", res);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
vector <int> a[20];
int cc[20][20], all, n;
int mem[20][1<<15];
vector <int> cst[1<<15], cst1[1<<15], cst2[1<<15], cst3[1<<15];
int dp(int x, int msk){
//  if(x==n-1)
//    cout<<x<<" "<<msk<<endl;
  if(x==n)
    return 0;
  if(mem[x][msk]!=-1){
    return mem[x][msk];
  }
  int res=-1e9*(x!=n-1), comp=((1<<n)-1)^msk;
  for(int i=0; i<cst2[msk].size(); ++i){
    res=max(res, cst3[msk][i]+dp(x, msk|cst2[msk][i]));
  }
//  for(int i=comp; i; i=(i-1)&comp){
//    if(cst[msk].count(i))
//      res=max(res, cst[msk][i]+dp(x, i|msk));
//  }
  for(int i=0; i<a[x].size(); ++i){
    if((1<<a[x][i])&msk) continue;
      res=max(res, cc[x][a[x][i]]+dp(a[x][i], msk|(1<<a[x][i])));
  }
  mem[x][msk]=res;
  return res;
}
vector < pair< int, pair<int,int> > > v2;
vector <int> bits[1<<15];
int sm[1<<15][15], xx[1<<15], v[1<<15];
int main(){
  int m, x, y, c;
  cin>>n>>m;
  all=0;
  for(int i=0; i<m; ++i){
    scanf("%d%d%d",&x,&y,&c);
    --x;--y;
    cc[x][y]=c;
    cc[y][x]=c;
    a[x].push_back(y);
    a[y].push_back(x);
    all+=c;
  }
  int comp, tmp, jj, sum;
  for(int i=1; i<(1<<n); ++i){
    for(int j=0; j<n; ++j){
      if(i&(1<<j)){
        bits[i].push_back(j);
        for(int k=0; k<n; ++k){
          sm[i][k]+=cc[j][k];
        }
      }
    }
  }
//  vector<int> v;
  int cnt=0, sz;
  for(int i=1; i<(1<<n); ++i){
    sum=0;
    for(int j=0; j<bits[i].size(); ++j){
      for(int k=j+1; k<bits[i].size(); ++k){
        sum+=cc[bits[i][j]][bits[i][k]];
      }
    }
    comp=((1<<n)-1)^i;
    jj=0;
//    v.clear();
    sz=0;
    for(int j=comp; j; j=(j-1)&comp){
//      v.push_back(j);
      v[sz++]=j;
    }
    reverse(v, v+sz);
    for(int j=0; j<sz; ++j){
//      ++cnt;
      jj=(v[j]-1)&v[j];
      tmp=v[j]^jj;
      tmp=bits[tmp][0];
//      for(int k=0; k<bits[i].size(); ++k){
////        cout<<bits[i][k]<<" ";
//        sm+=cc[bits[i][k]][tmp];
//      }
//      cout<<"="<<sm<<endl;
        cst[i].push_back(v[j]);
        if(j>0){
          cst1[i].push_back(max(cst1[i][xx[jj]], sum+sm[i][tmp]));
        }
        else{
          cst1[i].push_back(sum+sm[i][tmp]);
        }
        xx[v[j]]=j;
//      cst[v[j]][i]=max(cst[jj][i], sum+sm[i][tmp]);
//      for(int k=0; k<n; ++k)
//        if((1<<k)&i)
//          cout<<k<<" ";
//      cout<<endl;
//      for(int k=0; k<n; ++k)
//        if((1<<k)&v[j])
//          cout<<k<<" ";
//      cout<<"==="<<cst[v[j]][i]<<endl;
    }
  }
  for(int i=1; i<(1<<n); ++i){
    for(int j=0; j<cst[i].size(); ++j){
      cst2[cst[i][j]].push_back(i);
      cst3[cst[i][j]].push_back(cst1[i][j]);
    }
  }
//  cout<<cnt<<endl;
//  cout<<all<<endl;
//  memset(mem, -1, sizeof mem);
//  cout<<dp(0,1)<<endl;
  memset(mem, -1, sizeof mem);
  cout<<all-dp(0,1)<<endl;
  return 0;
}


Measured memory_bytes: 236928
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 2e5+5;
int n;
ll a[N],b[N],f[N],g[N],ans=1e18;
int main(){
    cin>>n;
    for (int i=1; i<=n; i++) scanf("%lld",&a[i]);
    stack<pii> stk;
    for (int i=2; i<=n; i++){
        f[i]=f[i-1];//前面部分递减
        ll pre=a[i-1],now=a[i];
        while (pre<a[i]){
            pre*=4;
            if (stk.empty()) f[i]+=(i-1)*2;
            else{
                pii p=stk.top();
                stk.pop();
                f[i]+=(i-p.first)*2;
                if (--p.second) stk.push(p);
            }
        }
        ll cnt=0;
        while (now*4<=pre) now*=4,cnt++;
        if (cnt) stk.push({i,cnt});
    }
    while (!stk.empty()) stk.pop();
    reverse(a+1,a+1+n);
    for (int i=2; i<=n; i++){
        g[i]=g[i-1];
        ll pre=a[i-1],now=a[i];
        while (pre<a[i]){
            pre*=4;
            if (stk.empty()) g[i]+=(i-1)*2;
            else{
                pii p=stk.top();
                stk.pop();
                g[i]+=(i-p.first)*2;
                if (--p.second) stk.push(p);
            }
        }
        ll cnt=0;
        while (now*4<=pre) now*=4,cnt++;
        if (cnt) stk.push({i,cnt});
    }
    reverse(g+1,g+1+n);
    for (int i=0; i<=n; i++) ans=min(ans,f[i]+g[i+1]+i);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>s;
    if(s.front()==s.back()){
        if(s.size()%2)cout<<"Second";
        else cout<<"First";
    }
    else{
        if(s.size()%2)cout<<"First";
        else cout<<"Second";
    }
    return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;
int main(void)
{
	int i,cnt,n,m;
	long long sum;
	P pp[100000];
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++)	scanf("%d %d",&pp[i].first,&pp[i].second);
	sort(pp,pp+n);
	cnt=0;	sum=0;
	for(i=0;i<n;i++)	{
		if(cnt+pp[i].second>=m)	{
			sum+=(long long)(m-cnt)*pp[i].first;
			break;
		}
		else {
			sum+=(long long)pp[i].second*pp[i].first;
			cnt+=pp[i].second;
		}
	}
	printf("%lld\n",sum);
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pss = pair<string, string>;
int n;
const int maxn = 50;
map<pss, int> M;
char s[maxn];
ll ans;
int main()
{
	scanf("%d", &n);
	scanf("%s", s);
	int S = (1 << n) - 1;
	for(int i = 0; i <= S; ++i)
	{
		pss ret;
		for(int j = 0; j < n; ++j)
			if(i & (1 << j))
				ret.first += s[j];
			else 
				ret.second += s[j];
		++M[ret];
	}
	for(int i = 0; i <= S; ++i)
	{
		pss ret;
		for(int j = 0; j < n; ++j)
			if(i & (1 << j))
				ret.second += s[j + n];
			else
				ret.first += s[j + n];
		reverse(ret.first.begin(), ret.first.end());
		reverse(ret.second.begin(), ret.second.end());
		ans += M[ret];
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 61116
#include<stdio.h>

int binary_search(int key);

int matrix_main[100000];
int matrix_sub[50000];

int main_count = 0;
int sub_count = 0;

int binary_search(int key){
  int left = 0,right = main_count;
  int mid;

  while(right-left>1){
    mid = (left+right)/2;
    if(key<matrix_main[mid])right=mid;
    else left=mid;
  }

  return matrix_main[left]==key;
}


int main(){

  int i=0,key;
  int count = 0;

  scanf("%d",&main_count);
  for(i = 0 ; i < main_count ; i++)
    scanf("%d",&matrix_main[i]);


  scanf("%d",&sub_count);
  for(i = 0 ; i < sub_count ; i++){
    scanf("%d",&key);
    if(binary_search(key)) count++;
  }
  printf("%d\n",count);
  return 0;

}

Measured memory_bytes: 988
import sys

a = []
for l in sys.stdin:
    a.append(l)

_input = a[0]

def is_month(x):
    # x: 2桁の数字
    if 12 >= x > 0:
        return True
    else:
        return False


input_l = int(_input[:2])
input_r = int(_input[2:])

if is_month(input_l):
    if is_month(input_r):
        result = 'AMBIGUOUS'
    else:
        result = 'MMYY'
else:
    if is_month(input_r):
        result = 'YYMM'
    else:
        result = 'NA'

print(result)


Measured memory_bytes: 3060
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


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;
}

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


void solve() {
	ll n, p;
	cin >> n >> p;
	string s;
	cin >> s;

	if (p == 2 || p == 5) {
		ll con = 0;
		REP(i, n) {
			ll num = s[i] - '0';
			if (num % p == 0) con += i + 1;
		}
		cout << con << en;
		return;
	}

	Array sum(p, 0);
	sum[0]++;
	ll pos = 1;
	ll d = 0;

	for (ll i = n - 1; i >= 0; i--) {
		ll num = s[i] - '0';
		(d += pos * num % p) %= p;
		sum[d]++;
		(pos *= 10) %= p;
	}
	ll ans = 0;
	REP(i, p) {
		if (sum[i] >= 2) ans += sum[i] * (sum[i] - 1) / 2;
	}
	cout << ans << en;
}

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

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}


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

int main(){
int A,B,C;
cin>>A>>B>>C;
if(A==5&&B==5&&C==7)cout<<"YES"<<endl;
else if(A==5&&B==7&&C==5)cout<<"YES"<<endl;
else if(A==7&&B==5&&C==5)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
A = int(input())
B = int(input())

A_s =str(A)
B_s = str(B)

if len(A_s) > len(B_s):
    print("GREATER")
elif len(A_s) < len(B_s):
    print("LESS")
else:
    for i in range(len(A_s)):
        if A_s[i] > B_s[i]:
            print("GREATER")
            break
        elif A_s[i] < B_s[i]:
            print("LESS")
            break
        elif (A_s[i] == B_s[i]) & (i == len(A_s)-1):
            print("EQUAL")
            break
            
    
            

Measured memory_bytes: 3064
// Keitai Message
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2006&lang=jp
package main

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

var table = []string{
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz",
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := nextInt(sc)

	for i := 0; i < n; i++ {
		message := nextString(sc)
		currentButton, count := 0, 0
		for _, word := range message {
			// 確定の処理を書く
			if word == '0' {
				if currentButton == 0 {
					count = 0
					continue
				}
				mod := len(table[currentButton])
				tmp := table[currentButton][(count-1)%mod]
				currentButton, count = 0, 0
				fmt.Printf("%c", tmp)
			} else {
				count++
				currentButton = int(word) - 48 // '0'はASCIIで48
			}
		}
		fmt.Println()
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}



Measured memory_bytes: 1192
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[100],dp[500][500];

int main(){
  cin >> n >> m;
  print((n+m+1)/2);
  return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t N,K;
  cin>>N>>K;
  int64_t ans=0;
  if(K==0)
    cout<<N*N<<endl;
  else{
  for(int64_t b=K+1;b<=N;b++){
  int64_t a=N/b;
    int64_t k=N%b;
    int64_t zero=0;
    int64_t x=a*(b-K)+max(k-K+1,zero);
    ans+=x;
  
  }cout<<ans<<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);
        String c = sc.nextLine();

        c = c.replaceAll("a", "");
        c = c.replaceAll("i", "");
        c = c.replaceAll("u", "");
        c = c.replaceAll("o", "");
        c = c.replaceAll("e", "");

        if (c.length() == 0) {
            System.out.println("vowel");
        } else {
            System.out.println("consonant");
        }

    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

ll power(int n){
    ll res = 1;
    while(n--){
        res *= 10;
    }
    return res;
}

int f(ll n){
    int res = 0;
    while(n){
        n /= 10;
        res++;
    }
    return res;
}

int main(){
    string s;
    cin >> s;
    int n = s.size();
    vi a(n);
    rep(i,n){
        a[n-1-i] = s[i] - '0';
    }
    ll ans = 0;
    for(int i=0;i<(1<<n-1);i++){
        bitset<10> bit(i);
        //cout << bit << endl;
        ll tmp = a[0];
        ll sum = 0;
        for(int j=1;j<n;j++){
            if(bit.test(j-1)){
                sum += tmp;
                tmp = a[j];
            }else{
                tmp += (ll)a[j] * (ll)power(f(tmp));
            }
            //cout << "tmp " << tmp << " a[j] = " << a[j] << endl;
        }
        if(tmp>0) sum += tmp;
        //cout << sum << endl;
        ans += sum;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define xx first
#define yy second
#define mp make_pair
const int N = 1000010;
typedef long long ll;
char s[N];
int n,m,k;
void solve()
{
    int l=0,r=0;
    while(l<n&&s[l]!='D')
    {
        l++;
    }
    ll answer=0;
    ll all_m=0,tmp_m=0;
    ll num_c=0;
    ll ans = 0;
    r=l;
    while(l<n&&r<n)
    {
        while(r+1<n&& r + 1 - l<k)
        {
            r++;
            if(s[r]=='M')
                tmp_m++;
            if(s[r]=='C')
            {
                all_m += tmp_m;
                tmp_m = 0;
                ans += all_m;
                num_c++;
            }
        }
        answer += ans;
        l++;
        while(l<n&&s[l]!='D')
        {
            if(s[l]=='M')
            {
                if(all_m>0)
                    all_m--;
                else if(tmp_m>0)
                    tmp_m--;
                ans-=num_c;
            }
            if(s[l]=='C')
            {
                if(num_c>0)
                    num_c--;
            }
            l++;
        }
    }

    printf("%lld\n",answer);
}
int main()
{
    scanf("%d%s%d",&n,s,&m);
    while(m--)
    {
        scanf("%d",&k);
        solve();
    }
    return 0;
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
using namespace std;
typedef long long LL;

#define _CRT_SECURE_NO_WARNINGS
int N;
int a[10010];
int b[10010];
int main() {
	scanf("%d",&N);
	int aSum = 0, bSum = 0;
	for (int i = 0; i < N; i++) {
		scanf("%d", a + i);
	}
	for (int i = 0; i < N; i++) {
		scanf("%d",b+i);
	}
	LL nolma=0,used=0;
	for (int i = 0; i < N; i++) {
		if (a[i]<b[i]){
			nolma += (b[i] - a[i]) % 2;
			used += (b[i] - a[i] + 1) / 2;
		}
		else {
			nolma += a[i] - b[i];
		}
	}
	if ( used>=nolma ) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}

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

#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;
 
# define S second
# define F first
# define kill(x) return(cout << x << endl, 0)
# define debug(x) cerr<< #x << " : " << x << endl
# define ddebug(x, y) cerr<< #x << " : " << x  << ", " << #y << " : " << y << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)
# define UB upper_bound 

const int MAXN = 2000 + 10;
int a[MAXN], 
    mn[MAXN];

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int n, x;
	cin >> n >> x;
	for (int i = 0; i < n; i ++)
		cin >> a[i];

	memset(mn, 63, sizeof mn);
	int ans = LLONG_MAX;
	for (int i = 0; i <= n; i ++)
	{
		int cur = i * x;
		for (int j = 0; j < n; j ++)
		{
			smin(mn[j], a[(j - i + n) % n]);
			cur += mn[j];
		}
		smin(ans, cur);
	}
	cout << ans << endl;

	return 0;
}


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

int main(){
	int x;
	cin >> x;
	int max = 0;
	for(int b = 1; b <= 32; b++){
		for(int p = 2; p <=9 ; p++){
			if(max < pow(b, p)&& pow(b, p) <= x)max = pow(b, p);
		}
	}
	cout << max << endl;
}

Measured memory_bytes: 256
#! /usr/bin/env python3

import math

n, k = map(int, input().split()) 

evens = n // k
k_halfs = (n + (k // 2)) // k

sum_a_even = evens * evens * evens

sum_a_odd = 0
if k % 2 == 0:
    sum_a_odd = k_halfs * k_halfs * k_halfs

print(sum_a_even + sum_a_odd)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
 
long long mod_inv(long long n)
{
    long long left=MOD-2;  // define MOD!
    long long num=n;
    long long ans=1;
    while(left!=0)
    {
        if(left%2==1)ans=(ans*num)%MOD;
        left/=2;
        num=(num*num)%MOD;
    }
    return ans;
}

int main()
{
  long long  n;cin>>n;
  vector<long long> x(n);
  long long i;
  for(i=0;i<n;i++)cin>>x.at(i);
  long long nk=1;
  for(i=1;i<=n-1;i++)
  {
    nk=(nk*i)%MOD;
  }
  vector<long long> rsw(n-1,nk);
  for(i=0;i<n-1;i++)
  {
    rsw.at(i)=(rsw.at(i)*mod_inv(i+1))%MOD;
  }
  for(i=1;i<n-1;i++)
  {
    rsw.at(i)=(rsw.at(i-1)+rsw.at(i))%MOD;
  }
  long long ans=0;
  for(i=0;i<n-1;i++)
  {
    ans=(ans+rsw.at(i)*(x.at(i+1)-x.at(i)))%MOD;
  }
  cout<<ans<<endl;
}

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

namespace abc127_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            if (a<=5)
            {
                Console.Write(0);
            }
            else if (a<=12)
            {
                Console.Write(b/2);
            }
            else
            {
                Console.Write(b);
            }
            Console.Read();
        }
    }
}


Measured memory_bytes: 11092
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int)(x).size())
#define MSG(a) cout << #a << " " << a << endl;

int main()
{
    int N;
    int isOK = false;
    cin >> N;
    for (int i = 9; i > 0; i--)
    {
        if (N % i == 0 && N / i <= 9)
        {
            isOK = true;
            break;
        }
    }
    if (isOK)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << " No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
//const ll mod = 1000000007LL;
const ll mod = 998244353LL;


ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222



ll sum[MAX];



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


  cin >> n;
  cin >> s;
  rep(i, n) {
    if (i) sum[i] = sum[i - 1];
    if (s[i] == '#') sum[i]++;
  }
  ans = sum[n - 1];
  ll cur = 0;
  rrep(i, n) {
    if (s[i] == '.') cur++;
    if (i) tmp = sum[i - 1];
    else tmp = 0;
    ans = min(ans, cur + tmp);
  }


  cout << ans << endl;





  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int h, w, n, SR, SC;
	string s, t;
	cin>>h>>w>>n>>SR>>SC>>s>>t;
	--SR;
	--SC;
	int lb=-1, ub=w;
	FORR(i, 0, n){
		// DEBUG(ub);
		if(t[i]=='L'){
			++ub;
		}
		if(t[i]=='R'){
			--lb;
		}
		if(s[i]=='L'){
			lb=max(lb+1, 0);
		}
		if(s[i]=='R'){
			ub=min(ub-1, w-1);
		}
		if(lb>=w-1 || ub<=0 || ub-lb<=1){
			cout<<"NO"<<'\n';
			return 0;
		}
	}
	if(SC<=lb || ub<=SC){
		cout<<"NO"<<'\n';
		return 0;
	}
	// DEBUG(lb);
	// DEBUG(ub);

	lb=-1, ub=h;
	FORR(i, 0, n){
		if(t[i]=='U'){
			++ub;
		}
		if(t[i]=='D'){
			--lb;
		}
		if(s[i]=='U'){
			lb=max(lb+1, 0);
		}
		if(s[i]=='D'){
			ub=min(ub-1, h-1);
		}
		if(lb>=h-1 || ub<=0 || ub-lb<=1){
			cout<<"NO"<<'\n';
			return 0;
		}
	}
	if(SR<=lb || ub<=SR){
		cout<<"NO"<<'\n';
		return 0;
	}
	// DEBUG(lb);
	// DEBUG(ub);
	cout<<"YES"<<'\n';
	return 0;
}


Measured memory_bytes: 920
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

constexpr double PI = acos(-1.0);

int main() {
	double a, b, C;
	cin >> a >> b >> C;
	
	C = (C / 180.0) * PI;
	
	double c = sqrt(a * a + b * b - 2.0 * a * b * cos(C));
	double S = a * b * sin(C) / 2.0;
	double L = a + b + c;
	double h = 2.0 * S / a;
	
	cout << fixed << setprecision(10);
	cout << S << '\n' << L << '\n' << h << '\n';
	
	return 0;
}


Measured memory_bytes: 3516
#include<iostream>
#include<map>
using namespace std;
typedef long long ll;

const int MAX_N = 1e5 + 1;
const ll MOD = 1e9 + 7;

ll dp[MAX_N];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    int A;
    map<int, bool> is_broken;
    for (int i = 0; i < M; i++) {
        cin >> A;
        is_broken[A] = true;
    }
    dp[0] = 1;
    for (int i = 1; i <= N; i++) {
        if (is_broken[i]) continue;
        dp[i] = (dp[i] + dp[i - 1]) % MOD;
        if (i - 2 >= 0) {
            dp[i] = (dp[i] + dp[i - 2]) % MOD;
        }
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 5760
//g++ -std=c++14 test.cpp -o test.out
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
using namespace std;

int N,Q;
int a[200000],b[200000];
int p[200000],x[200000];

long ans[200001];//頂点iのスコア
 
void solve(){
	memset(ans,0,sizeof(long)*200001);//頂点iのスコアを0で初期化
	vector<vector<int>> list(N+1);//list[i]は頂点iから行ける点の集合
	for(int i=0;i<N-1;i++){
		list[a[i]].push_back(b[i]);
		list[b[i]].push_back(a[i]);
	}
	for(int i=0;i<Q;i++){
		ans[p[i]] += x[i];
	}

	bool visited[200001];//頂点iに訪れているならばvisited[i] = true;
	memset(visited,0,sizeof(bool)*200001);
	queue<int> q;
	q.push(1);
	while(!q.empty()){
		int vertex = q.front();
		q.pop();
		visited[vertex] = true;
		for(int i=0;i<list[vertex].size();i++){
			int next_node = list[vertex][i];
			if(!visited[next_node]){
				ans[next_node] += ans[vertex];
				q.push(next_node);
			}
		}
	}
}
 
int main(){
	cin>>N>>Q;
	for(int i=0;i<N-1;i++) cin>>a[i]>>b[i];
	for(int i=0;i<Q;i++) cin>>p[i]>>x[i];

	solve();

	for(int i=1;i<=N;i++){
		cout << ans[i] << ' ';
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 17652
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//
//  
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
// const double PI=3.1415926535897932;

//#define __DBG__


void solve(void){
  
  ll N;
 
  cin >> N;
  
  ll ans=(N-1)*N/2;

  
  cout << ans << endl;
  
  return;
   
}


int main(int argc, const char * argv[]) {

    cin.tie(0);
    ios::sync_with_stdio(false);

    solve();
 
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define	pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigboi        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(all(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 

//int dp[333][2];
void solve(){
	int n, res=INT_MAX;
	cin>>n;
	int arr[n];
	FOR(i, 0, n){
		cin>>arr[i];
	}
	int mx = *(max_element(arr, arr+n)), mn = *(min_element(arr, arr+n));
	FOR(i, mn, mx+1){
		int temp=0;
		FOR(j, 0, n){
			temp+=((arr[j]-i)*(arr[j]-i));
		}
		res = min(res, temp);
	}
	cout<<res<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0); 	
	int t=1;
	//cin>>t;
	FOR(i, 1, t+1){	
	//	cout<<"Case #"<<i<<":"<<endl;
		solve();
	}
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
 
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

const int N=25,S=(1<<19)+5,Mo=1e9+7;

int n,m,k,a,b,c[N][N],nxt[S][N],f[2][N][S];

void inc(int &x,int y) {
	x=x+y;
	if (x>=Mo) x=x-Mo;
}

int main() {
	scanf("%d%d%d",&n,&m,&k);n--;
	fo(i,1,m) fo(j,0,n-1) c[i][j]=-1;
	fo(i,1,k) {
		scanf("%d%d",&a,&b);
		scanf("%d",&c[a][b-1]);
	}
	fo(s,0,(1<<n)-1) {
		nxt[s][n]=-1;
		fd(j,n-1,0)
			if (s&(1<<j)) nxt[s][j]=j;
			else nxt[s][j]=nxt[s][j+1];
	}
	f[0][n][0]=1;
	int p=0,q=1;
	fo(i,0,m-1) {
		memset(f[q],0,sizeof(f[q]));
		fo(s,0,(1<<n)-1) f[q][0][s]=f[p][n][s];
		fo(j,0,n-1) 
			fo(s,0,(1<<n)-1) 
				if (f[q][j][s]) {
					fo(x,0,1) {
						if (c[i+1][j]!=-1&&c[i+1][j]!=x) continue;
						if (!x&&(s&(1<<j))) continue;
						if (x==((s&(1<<j))>0)) inc(f[q][j+1][s],f[q][j][s]);
						else {
							if (nxt[s][j]==-1) inc(f[q][j+1][s+(1<<j)],f[q][j][s]);
							else inc(f[q][j+1][s+(1<<j)-(1<<nxt[s][j])],f[q][j][s]);
						}
					}
				}
		swap(p,q);
	}
	int ans=0;
	fo(s,0,(1<<n)-1) inc(ans,f[p][n][s]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 153728