akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
    static final double EPS = 0.00001;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            double q = sc.nextInt();
            if (q < 0)
                break;

            double x = q / 2.0;

            while (Math.abs(x * x * x - q) >= EPS * q) {
                x = x - (x * x * x - q) / (3 * x * x);
            }

            System.out.printf("%.6f\n", x);
        }
    }
}


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

int main(){
	int n;
 	cin >>n;
  	int a = n;
	int tmp=0;
  	while(a > 0) {
    	tmp += a% 10;
    	a /=10;
      
    }
  	if(n  % tmp == 0)
      	cout << "Yes\n";
  	else
      	cout << "No\n";
      
      
}


Measured memory_bytes: 256
"""dpまじでわからん"""
'''
Created on 2020/08/29

@author: harurun
'''
import sys
N=int(sys.stdin.readline())
h=list(map(int,sys.stdin.readline().split()))
dp=[0]*N

for i in range(1,N):
  if i>=2:
    dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))
  else:
    dp[i]=dp[i-1]+abs(h[i-1]-h[i])
print(dp[N-1])
# print(dp)

Measured memory_bytes: 20616
#include <stdio.h>
#include <stdlib.h>
#define MAX 500000
#define INFITY 1000000001

void merge(int [],int,int,int);
void mergeSort(int [] ,int ,int);

int counter=0;

int main(){
  int A[MAX],n,  j;

  scanf("%d",&n);

  for(j=0;j<n;j++){
    scanf("%d",&A[j]);
  }

  mergeSort(A,0,n);
  for(j=0;j<n;j++){
    printf("%d",A[j]);
    if(j<n-1) printf(" ");
  }
  printf("\n%d\n",counter);

  return 0;
}

void merge(int A[],int left,int mid,int right)
{
  int n1,n2,i,j,k,*L,*R;

  n1 = mid - left;
  n2 = right - mid;
  L=malloc((n1+1)*sizeof(int));
  R=malloc((n2+1)*sizeof(int));
  for(i=0;i<=n1-1;i++){
    L[i] = A[left + i];
  }
  for(i=0;i<=n2-1;i++){
    R[i] = A[mid  + i];
  }

  L[n1]=INFITY;
  R[n2] = INFITY;

  i=j=0;
  for(k=left;k<right;k++){

    if(L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      counter++;
    }
    else{
      A[k] = R[j];
      j = j + 1;
      counter++;
    }
  }
  free(L);
  free(R);
}

void mergeSort(int A[],int left, int right){
  if(left+1 < right){
    int mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}


Measured memory_bytes: 5440
#include <algorithm>  //min, max, sort, unique, fill
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>  //pair, swap,
#include <vector>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using VI = vector<ll>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) for (ll i = 0; i < (n); i++)

static const ll kIntMax = numeric_limits<ll>::infinity();
static const double kFloatMax = numeric_limits<double>::infinity();

vector<ll> vi;

int main() {
  ll a, b, c, x, y;
  cin >> a >> b >> c >> x >> y;
  ll price = 0, tmp;
  // price = 1000000000;
  // REP(i, 100001) {
  //   tmp = i * c * 2 + max(0ll, x - i) * a + max(0ll, y - i) * b;
  //   if (tmp < price) price = tmp;
  //   if (i > x && i > y) break;
  // }

  if (a + b < c * 2)
    price = a * x + b * y;
  else {
    if (c * 2 <= a) {
      price += x * c * 2;
      y -= x;
      x = 0;
      // cerr << "price:" << price << "x:" << x << "y:" << y << endl;
    }

    if (c * 2 <= b && y > 0) {
      price += y * c * 2;
      x -= y;
      y = 0;
      // cerr << "price:" << price << "x:" << x << "y:" << y << endl;
    }

    x = max(0ll, x);
    y = max(0ll, y);

    ll z = min(x, y);
    price += z * c * 2 + (x - z) * a + (y - z) * b;
    // cerr << "price:" << price << "x:" << x << "y:" << y << "z:" << z <<endl;
  }

  cout << price << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using namespace std;

// long long gcd(long long a, long long b){
//     if (a < b){
//         a ^= b;
//         b ^= a;
//         a ^= b;
//     }
//     return b ? gcd(b, a % b) : a;
// }

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

int main(){
    long long x,i,a[10000001];
    a[0]=0;
    cin >> x;
    
    for(i=1;a[i-1]<x;i++){
        a[i] = a[i-1]+i;
    }
    
    cout << i-1 << endl;
}


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

int main () {
  int x, y;
  cin >> x >> y;
  
  bool ok = false;
  rep(i,x+1) {
    if (y == 4*x - 2*i)
      ok = true;
  }
  
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3632
import scala.io.{ StdIn => in}

object Main extends App {
  val Array(k, s) = in.readLine.split(" ").map(_.toInt)

  val ans = {
    var res = 0
    for(z <- 0 to k; sz = s -z; i <- 0 to k) {
      val x = sz - i
      if(0 <= x && x <= k) res += 1
    }
    res
  }

  println(ans)
}

Measured memory_bytes: 27928
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
int b;
cin>>b;
if(b==25)
    cout<<"Christmas";
else if (b==24)
    cout<<"Christmas Eve";
else if (b==23)
    cout<<"Christmas Eve Eve";
else
    cout<<"Christmas Eve Eve Eve";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int n = s.length();
  vector<vector<long> >dp(n+1,vector<long>(13,0));
  dp[0][0] = 1;
  long const mod = 1000000007;
  int i,j,k;
  for(i=0;i<n;i++){
    if(s[i]=='?'){
      for(j=0;j<=9;j++){
        for(k=0;k<13;k++){
          dp[i+1][(10*k+j)%13] += dp[i][k];
          dp[i+1][(10*k+j)%13]%=mod;
        }
      }
    }else{
      j = (int)(s[i]-'0');
      for(k=0;k<13;k++){
        dp[i+1][(10*k+j)%13] += dp[i][k];
        dp[i+1][(10*k+j)%13]%=mod;
      }
    }
  }
  cout << dp[n][5] << endl;
}


Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
#define ll   long long int
#define T int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define PI 3.141592653589793238462643383
#define pb push_back
#define all(s) s.begin(),s.end()

int main (){
    fast;
    
    int n;
    cin>>n;
    if(n){
        cout<<0<<endl;
    }else{
        cout<<1<<endl;
    }
    
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
int main()
{
    int x;
    cin>>x;
    int sum=0;
    if(x>=500)
    {
        int div=x/500;
        int rem=x%500;
        sum=sum+div*1000;
        if(rem>=5)
        {
            int div1=rem/5;
            sum=sum+div1*5;
        }
    }
    else
    {
        int div2=x/5;
        sum=sum+div2*5;
    }
    cout<<sum<<endl;

}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N;
    cin >> N;
    for (ll i = 0; i < N; i++) {
        for (ll j = i + 1; j < N; j++) {
            bitset<64> bit_i = bitset<64>(i);
            bitset<64> bit_j = bitset<64>(j);
            for (ll k = 0; ; k++) {
                if (bit_i[k] != bit_j[k]) {
                    cout << k + 1 << " \n"[j == N - 1];
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 512
#!/usr/bin/env python3
import collections
import itertools as it
import math
import numpy as np

#  = input()
#  = int(input())
N, K = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

if N >= K:
    seimin = N - (N//K) * K
    print(min(seimin, abs(seimin-K)))
else:
    print(min(N, abs(N-K)))


Measured memory_bytes: 21508
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  string S;
  cin>>N>>S;
  int ma=0;
  for(int i=1;i<N-1;i++){
    vector<int> A(26),B(26);
    int j=0;
    for(;j<=i;j++)
      A[S[j]-'a']++;
    for(;j<N;j++)
      B[S[j]-'a']++;
    int k=0;
    for(int j=0;j<26;j++)
      if(A[j]>0 && B[j]>0)
        k++;
    ma=max(ma,k);
  }
  cout<<ma<<endl;
}

Measured memory_bytes: 3592
import java.util.*

fun main(arr:Array<String>) {
    dic[true] = mutableListOf()
    dic[true]!!.addAll(map.indices.map { null })
    dic[false] = mutableListOf()
    dic[false]!!.addAll(map.indices.map { null })
    for(i in map.indices.reversed()) {
        if(map[i] == 'L') {
            nearL.add(i)
        } else {
            nearL.add(nearL.last())
        }
    }
    nearL.reverse()
    for(i in map.indices) {
        if(map[i] == 'R') {
            nearR.add(i)
        } else {
            nearR.add(nearR.last())
        }
    }
    val ans = map.indices.map { 0 }.toMutableList()
    for(i in map.indices) {
        val pos = getPos(i%2==0, i)
        ans[pos] += 1
    }
    println(ans.joinToString(" "))
}

val map = readLine()!!.map { it }
val nearL = mutableListOf<Int>()
val nearR = mutableListOf<Int>()
val dic = mutableMapOf<Boolean, MutableList<Int?>>()
fun getPos(startEven:Boolean, pos:Int):Int {
    if(map[pos] == 'R') {
        val tmp = nearL[pos]
        if((startEven && tmp % 2 == 1) || (tmp % 2 == 0 && !startEven)) {
            return tmp - 1
        } else {
            return tmp
        }
    } else {
        val tmp = nearR[pos]
        if((startEven && tmp % 2 == 1) || (tmp % 2 == 0 && !startEven)) {
            return tmp + 1
        } else {
            return tmp
        }
    }
}



Measured memory_bytes: 44764
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

s=SI()
for i in range(len(s)):
    for j in range(i,len(s)+1):
        s1=s[:i]
        s2=s[j:]
        if s1+s2=="keyence":
            print("YES")
            sys.exit()
print("NO")
        
        
        
            
        

                

Measured memory_bytes: 9356
n = int(input())
t = list(map(int,input().split()))
m = int(input())
PX = [list(map(int,input().split())) for _ in range(m)]
s = sum(t)
for i in range(m):
  ans = s - t[PX[i][0]-1] + PX[i][1]   
  print(ans)  

Measured memory_bytes: 3060
#include<iostream>
#include<string>
using namespace std;
int main(void) {
	int x;
	cin >> x;
	int happy(0);
	happy += 1000 * (x / 500);
	x %= 500;
	happy += 5 * (x / 5);
	cout << happy << endl;
	return 0;
}

Measured memory_bytes: 256
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        s: chars
    }

    let mut ans = 0;

    let s_len = s.len();

    let mut palin = true;
    let mut strong_palin = true;
    for i in 0..(s_len - 1) / 2 {
        let rev = (s_len - 1) - i;

        if s[i] != s[rev] {
            palin = false;
        }
    }

    if !palin {
        strong_palin = false;
    }

    if strong_palin {
        for i in 0..(s_len - 1) / 4 {
            let rev = (s_len - 1) / 2 - i - 1;
            if s[i] != s[rev] {
                strong_palin = false;
            }

            //println!("{} {}", s[i], s[rev]);
        }
    }

    println!("{}", if strong_palin { "Yes" } else { "No" });
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 8572
pub fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let s = read1::<String>().chars().map(|c| c as isize - 48).collect::<Vec<isize>>();
    
    for i in 0..2_usize.pow(3) {
        let mut ans = s[0].to_string();
        let mut tmp = s[0];
        for j in 0..3 {
            if i >> j & 1 == 1 {
                ans += "+";
                tmp += s[j + 1];
            } else {
                ans += "-";
                tmp -= s[j + 1];
            }
            ans += &s[j + 1].to_string();
        }

        if tmp == 7 {
            println!("{}=7", ans);
            return;
        }
    }
}

Measured memory_bytes: 4352
#include<stdio.h>
#define N 99

int main(void){
int n,i,j,k,l;
int r[N+1];
int c[N+1][N+1]={0};

scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%d%d",&r[i-1],&r[i]);


for(l=2;l<=n;l++){
for(i=1;i<=n-l+1;i++){
j=l+i-1;

c[i][j]=100000000000;

for(k=i;k<=j-1;k++){
if(c[i][j]>c[i][k]+c[k+1][j]+r[i-1]*r[k]*r[j]){
c[i][j]=c[i][k]+c[k+1][j]+r[i-1]*r[k]*r[j];
}
}
}
}
printf("%d\n",c[1][n]);
return 0;
}

Measured memory_bytes: 1892
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		double a = sc.nextDouble(); double b = sc.nextDouble(); double angle = Math.toRadians(sc.nextDouble());
		double c = Math.sqrt(a*a+b*b-(2*a*b*Math.cos(angle)));
		
		double x = (a*a+b*b-c*c)/(2*a);
		double y = Math.sqrt(b*b-x*x);
		
		System.out.println(String.format("%.5f",a*y/2));
		System.out.println(String.format("%.5f",a+b+c));
		System.out.println(String.format("%.5f",y));
	}
}


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

int main() {
  int64_t N;
  cin >> N;
  int64_t sum = 0;
  for(int i = 1;i <= N;i++){
    if(i % 3 == 0 || i % 5 == 0){
      continue;
    }
    
    sum += i;
  }
  
  cout << sum << endl;
  
}


Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
int cnt[30010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;
    int ans = 0;
    rep(s, 100) {
        int tmp = s;
        int i = 0, j = 0;
        while(i < N && S[i] != '0' + tmp % 10) i++;
        j = i + 1;
        tmp /= 10;
        while(j < N && S[j] != '0' + tmp % 10) j++;
        if (j == N) continue;
        set<int> st;
        int k = j + 1;
        while(k < N) st.insert(S[k++]);
        ans += st.size();
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);

	if(((a+b)==c)|((b+c)==a)|(c+a==b))printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}

int main() {
  int a;
  char b[3];
  cin >> a >> b;
  int n=strlen(b);
  int x=pow(10,n)*a;
  REP(i,n) {
    x+=(b[i]-'0')*pow(10,n-1-i);
  }
  int xx=sqrt(x);
  if(x%xx==0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 4116
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  for (int x = 1; x <= (25 * 50000 - 1) / 27 + 1; ++x) {
    int y = static_cast<int>(x * 1.08);
    if (y == n) {
      cout << x << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define fore(i,a,b) for(int i = a; i < b; i++)
#define fst first
#define snd second
#define ll long long
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int>
#define piii pair<int, pii>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;

const int N_MAX = 1e5+15;
const ll Z = 1000000000000000000LL;
ll A[N_MAX];

int main(){
    int N;
    cin>>N;
    bool zr=0;
    fore(i,0,N){
        cin>>A[i];
        if(A[i]==0LL) zr=1;
    }
    ll M = 1LL;
    bool ans = 1;
    if(zr){
        M=0LL;
    }
    else{
        fore(i,0,N){
            ll q = Z/M;
            if(A[i]>q){
                ans = 0;
                break;
            }
            M*=A[i];
        }
    }
    if(ans) cout<<M<<endl;
    else cout<<"-1"<<endl;
    return 0;
}

Measured memory_bytes: 4364
import itertools

n = int(input())
s = input().rstrip()

colname = {'R': 0, 'G': 1, 'B': 2}
color = [[], [], []]
for i in range(n):
    ci = colname[s[i]]
    color[ci].append(i + 1)
color = sorted(color, key=lambda x: len(x))

color[2] = set(color[2])
nc2 = len(color[2])

x = 0
for r in color[0]:
    for g in color[1]:
        x += nc2
        if (r + r - g) in color[2]:
            x -= 1
        if (g + g - r) in color[2]:
            x -= 1
        c = r + g
        if c % 2 == 0 and (c // 2) in color[2]:
            x -= 1
print(x)

Measured memory_bytes: 9304
#標準入力とカウンタ変数の初期化
a,b,c = map(int,input().split())
kei = 0

#割り切れるならカウンタ変数を更新する
for i in range(b,c + 1):
    if a % i == 0:kei += 1
    
#カウンタ変数を出力する
print(kei)


Measured memory_bytes: 5596
#include<stdio.h>

int isPrime(int);

int main(){

  int i, j, N, number, count = 0;

  scanf("%d", &N);

  for(i = 0; i <  N; i++){

    scanf("%d", &number);

    if(isPrime(number))
      count++;

  }

  printf("%d\n", count);

  return 0;
}

int isPrime(int x){

  int i;

  if(x == 2)
    return 1;

  if(x < 2 || x % 2 == 0)
    return 0;

  i = 3;

  while(i * i <= x){
    if(x % i == 0)
      return 0;
    i = i + 2;
  }

  return 1;
}


Measured memory_bytes: 2100
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

ans = 0
for i in range(N):
    # モンスターのほうが多い
    if B[i] <= A[i]:
        ans += B[i]
    elif B[i] > A[i]:
        ans += A[i]
        B[i] -= A[i]
        if B[i] <= A[i+1]:
            ans += B[i]
            A[i+1] -= B[i]
        elif B[i] > A[i+1]:
            ans += A[i+1]
            A[i+1] = 0
print(ans)

Measured memory_bytes: 18624
import copy
N=int(input())
A=list(map(int,input().split()))
allcost=abs(0-A[0])
for i in range(N-1):
    allcost=allcost+abs(A[i]-A[i+1])
allcost=allcost+abs(A[N-1])
#print(allcost)
A.insert(0,0)
A.append(0)
for i in range(N):
    print(allcost-abs(A[i+1]-A[i])-abs(A[i+2]-A[i+1])+abs(A[i+2]-A[i]))


Measured memory_bytes: 63196
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
	cin.tie(0), ios::sync_with_stdio(false);
	int n,m,d; cin >> n >> m >> d;
	if(d) cout << setprecision(10) << 2.0*(n-d)/n/n*(m-1);
	else cout << setprecision(10) << 1.0/n*(m-1);
	cout << "\n";
	return 0;
}


Measured memory_bytes: 3732
n,k = map(int,input().split())
list = []
for i in range(n):
  list.append(int(input()))
list.sort()
min = list[n-1]
for j in range(n-k+1):
  if list[j+k-1]-list[j] < min:
    min = list[j+k-1]-list[j]
print(min)

Measured memory_bytes: 51544
def pallindrome(s):
  x = len(s)
  flag = 0
  for i in range(x//2):
    if s[i] != s[x-1-i]:
      flag = 1
      break
  return flag
s = input()
n = len(s)
newS = pallindrome(s)
a = pallindrome(s[:((n-1)//2)])
b = pallindrome(s[((n+2)//2):])
if newS == 0 and a == 0 and b == 0:
  print("Yes")
else:
  print("No")

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

        int n, modNum = -1;
        String yesNo;

        n = sc.nextInt();

        for(int i = 1; i < 10; i++)
        {
            modNum = n % i;
            if(modNum == 0 && (n/i) <= 9)
            {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

bool compare(pair<int,int> a,pair<int,int> b){
	if(a.second != b.second){
		return a.second < b.second;
	}else{
		return a.first < b.first;
	}
}

int main(int argc, char** argv){
	int n;
	cin >> n;
	vector<pair<int ,int> > p(n);
	for(int i = 0; i < n; i++){
		int a,b;
		cin >> a >> b;
		p[i] = make_pair(a,b);
	}
	sort(p.begin(),p.end(),compare);
	long t = 0;
	for(int i = 0; i < n; i++){
		t += p[i].first;
		if(t > p[i].second){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1792
class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

if __name__ == '__main__':
    main()


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

int main(){
    int N;cin>>N;
    int p=sqrt(N*2);
    while((p+1)*p<N*2){
        p++;
    }
    int q=(p+1)*p/2-N;
    for(int i=1;i<=p;i++){
        if(abs(i-q))cout<<i<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>

using namespace std;
using namespace placeholders;

using LL = long long;
using ULL = unsigned long long;
using VI = vector< int >;
using VVI = vector< vector< int > >;
using VS = vector< string >;
using SS = stringstream;
using PII = pair< int, int >;
using VPII = vector< pair< int, int > >;
template < typename T = int > using VT = vector< T >;
template < typename T = int > using VVT = vector< vector< T > >;
template < typename T = int > using LIM = numeric_limits< T >;

template < typename T > inline istream& operator>>( istream &s, vector< T > &v ){ for ( T &t : v ) { s >> t; } return s; }
template < typename T > inline ostream& operator<<( ostream &s, const vector< T > &v ){ for ( int i = 0; i < int( v.size() ); ++i ){ s << ( " " + !i ) << v[i]; } return s; }
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define REP2( i, n ) REP3( i, 0, n )
#define REP3( i, m, n ) for ( int i = ( int )( m ); i < ( int )( n ); ++i )
#define GET_REP( a, b, c, F, ... ) F
#define REP( ... ) GET_REP( __VA_ARGS__, REP3, REP2 )( __VA_ARGS__ )
#define FOR( e, c ) for ( auto &&e : c )
#define ALL( c ) begin( c ), end( c )
#define AALL( a, t ) ( t* )a, ( t* )a + sizeof( a ) / sizeof( t )
#define DRANGE( c, p ) ( c ).begin(), ( c ).begin() + ( p ), ( c ).end()

#define SZ( v ) ( (int)( v ).size() )
#define EXIST( c, e ) ( ( c ).find( e ) != ( c ).end() )

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

#define PB push_back
#define EM emplace
#define EB emplace_back
#define BI back_inserter

#define MP make_pair
#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

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

	int N, M;
	scanf( "%d%d", &N, &M );

	VI num( N, 1 ), red( N );
	red[0] = 1;

	REP( _, M )
	{
		int X, Y;
		scanf( "%d%d", &X, &Y );
		--X, --Y;

		if ( num[X] == 1 && red[X] )
		{
			red[X] = 0;
			red[Y] = 1;
		}
		else
		{
			red[Y] |= red[X];
		}

		--num[X];
		++num[Y];
	}

	printf( "%d\n", count( ALL( red ), 1 ) );

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

int main(){
    int n;
    cin >> n;
    string s[n];
    for(int i=0;i<n;i++)cin >> s[i];
    string ans;
    for(char c = 'a';c<='z';c++){
        int count = 50000;
        for(int i=0;i<n;i++){
            int counta = 0;
            for(int j=0;j<s[i].size();j++)if(c == s[i][j])counta++;
        count = min(count,counta);
        }
        for(int a=0;a<count;a++)ans += c;
    }
    if(ans.size() > 0)cout << ans << endl;
    else cout << " " << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void YN(bool ans){
    if(ans)cout<<"AC"<<endl;
    else cout <<"WA"<<endl;
    return;
}
int main(){
    string S;
    cin>>S;
    bool ans = true;
    if(S[0] != 'A')ans = false;
    bool ok = false;
    ll c;
    rep(i,2,S.size()-1){
        if(S[i] == 'C'){
            ok = true;
            c=i;
            break;
        }
    }
    if(!ok)ans = false;
    rep(i,1,S.size()){
        if(i!=c){
            if(S[i] <= 'Z')ans = false;
        }
    }
    YN(ans);
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7

a.sort()


if n%2 == 1:
    b = [0]
    for i in range(1, (n-1)//2+1):
        b.append(i*2)
        b.append(i*2)
    if b == a:
        print((2**((n-1)//2))%mod)
    else:
        print(0)
else:
    b = []
    for i in range(n//2):
        b.append(1 + 2*i)
        b.append(1 + 2*i)
    if b == a:
        print((2**(n//2))%mod)
    else:
        print(0)
        

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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll H, N; cin >> H >> N;
    ll sum = 0;
    REP(i, N) {
        ll tmp; cin >> tmp;
        sum += tmp;
    }
    if (sum >= H) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
A = np.array(input().split(), dtype=np.int32)
B = np.array(input().split(), dtype=np.int32)
C = - np.array(input().split(), dtype=np.int32)
 
A.sort()
B.sort()
C.sort()
 
cnt_A = np.searchsorted(A,B,side='left')
cnt_C = np.searchsorted(C,-B,side='left')
 
answer = (cnt_A * cnt_C).sum()
print(answer)

Measured memory_bytes: 41600
# coding: utf-8
class Case04

  def initialize
  end

  def show
    p self.instance_variables
        .map{ |sym| [sym, self.instance_variable_get(sym)] }
        .to_h
  end
  
  # 実行する
  def execute
    read
    solve
    output
  end

  # 読込
  def read
    @n = gets.chomp.to_i
  end

  # 回答
  def solve
    # @result = (1..@n-1).reduce(0) {|r, x| r + x}
    @result = (@n-1) * @n / 2
  end
  
  # 出力
  def output
    puts @result
  end

end

Case04.new.execute if $0 == __FILE__



Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
#define MAX_E 30
#define MAX_V 9

struct edge{
  int from, to;
};
edge es[MAX_E];
int V,E;
bool h[MAX_V];

void input_graph(int E){
    int f,t;
    REP(i,E/2){
        cin>>f>>t;
        es[i*2].from=f;
        es[i*2].to=t;
        es[i*2+1].from=t;
        es[i*2+1].to=f;
    }
}

int dfs(int i, int d){
  //cout<<" i:"<<i<<" d:"<<d<<endl;
  if(d==V) return 1;
  int rtn=0;
  REP(j,E){
    if(es[j].from==i&&h[es[j].to]==0){
      h[es[j].to]=1;
      rtn+=dfs(es[j].to,d+1);
      h[es[j].to]=0;
    }
  }
  return rtn;
}

int main(){
  cin>>V>>E;
  E*=2;
  REP(i,MAX_V) h[i]=0;
  h[1]=1;
  
  input_graph(E);
  cout<<dfs(1,1);
  }

Measured memory_bytes: 256
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,h[100005];
ll dp[100005];

int main(){
	int N,M,K;
	std::cin >> N;
    //std::cin >> N >> M;
    //std::cin >> N >> M >> K;
    
    std::vector<long long> v(N+1);
 	
 	//stack<int> sta;   
    //queue<int> que;
    
 	
    // 入力
    int cnt,max;
    cnt=1;
    max=0;
    for(long long i=1; i<=N; i++){
		std::cin >> v[i];
		if(i!=1){
		if(max<=v[i]){
			cnt++;
		}
		}
		if(v[i]>=max){
			max=v[i];
		}
		
	}
    
    printf("%d",cnt);
    //printf("%d",N*M);
	return 0;
}

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

int main() {
	long long H, W, N, Cur = 0, MIN;
	vector<pair<long long, long long> > V;
	cin >> H >> W >> N;
	MIN = H;
	V.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> V[i].first >> V[i].second;
		V[i].first--, V[i].second--;
	}
	sort(V.begin(), V.end());
	for (int i = 0; i < N; i++) {
		if (V[i].first - V[i].second < Cur) continue;
		if (V[i].first - V[i].second == Cur) Cur++;
		else MIN = min(MIN, V[i].first);
	}
	cout << MIN << endl;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;
    //ll h,w,ans=0,tmp=0;
int main(){
    ll h,w,ans=0,tmp=0;
    cin>>h>>w;
    ll LR[2200][2200]={0},RL[2200][2200]={0},UD[2200][2200]={0},DU[2200][2200]={0};
    string s[h];
    rep(i,0,h)cin>>s[i];

    rep(i,0,h)if(s[i][0]=='.')LR[i][0]=1;
    rep(i,0,w)if(s[0][i]=='.')UD[0][i]=1;
    
    rep(i,0,h){
        rep(j,1,w){
            if(s[i][j]=='.')LR[i][j]=LR[i][j-1]+1;
            else LR[i][j]=0;
        }
        irep(j,w-1,0){
            if(s[i][j]=='.')RL[i][j]=RL[i][j+1]+1;
            else RL[i][j]=0;
        }
    }

    rep(i,0,w){
        rep(j,1,h){
            if(s[j][i]=='.')UD[j][i]=UD[j-1][i]+1;
            else UD[j][i]=0;
        }
        irep(j,h-1,0){
            if(s[j][i]=='.')DU[j][i]=DU[j+1][i]+1;
            else DU[j][i]=0;
        }
    }

     rep(i,0,h){
        rep(j,0,w){
            tmp=0;
            if(s[i][j]=='.')tmp=LR[i][j]+RL[i][j]+UD[i][j]+DU[i][j]-3;
            ans=max(ans,tmp);
        }
    }
    cout<<ans;
}


Measured memory_bytes: 157696
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,K;
  cin>>A>>B>>C>>K;
  for(int i=0;i<K;i++){
    if(A>=B && A>=C) A=A*2;
    else if(B>=A && B>=C) B=B*2;
    else if(C>=A && C>=B) C=C*2;
  }
  cout<<A+B+C<<endl;
    
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
write = sys.stdout.write
import itertools
def ii(): return int(readline())
def mi(): return map(int, readline().rstrip().split())
def li(): return list(readline().rstrip())
def lmi(): return list(map(int, readline().rstrip().split()))
def end(*arg): print(*arg); sys.exit()
# template


def main():
    n = ii()
    P = tuple(lmi())
    Q = tuple(lmi())
    p, q = 0, 0
    a = [i + 1 for i in range(n)]
    for idx, l in enumerate(itertools.permutations(a, n)):
        if P == l:
            p = idx
        if Q == l:
            q = idx
    print(abs(p - q))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 39280
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
    int a,b,c,x;
    while(~scanf("%d%d%d%d",&a,&b,&c,&x))
    {
        int ans=0;
        for(int i=0;i*500<=x && i<=a;i++)
            for(int j=0;j*100+i*500<=x && j<=b;j++)
            for(int k=0;k*50+j*100+i*500<=x && k<=c;k++)
            if(i*500+j*100+k*50==x)
            ans++;
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 128
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int a = 0, b = 0;
            for(int i = 0; i < s.Length; i++)
            {
                if (int.Parse(s[i].ToString()) != i % 2)
                {
                    a++;
                }
                else
                {
                    b++;
                }
            }

            if(a < b)
            {
                Console.WriteLine(a);
            }
            else
            {
                Console.WriteLine(b);
            }

        }
    }
}


Measured memory_bytes: 15164
#define _ITERATOR_DEBUG_LEVEL 1


#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	int a, b, n = 100, i, j, k, aa, bb;
	cin >> a >> b;
	vector<vector<bool>> x(n, vector<bool>(n, false));
	for (i = 0; i < n / 2; i++) {
		for (j = 0; j < n; j++) x[i][j] = true;
	}
	a--;
	b--;
	for (i = 0; i < b; i++) {
		aa = i / 50 * 2;
		bb = (i % 50) * 2;
		x[aa][bb] = false;
	}

	for (i = 0; i < a; i++) {
		aa = i / 50 * 2 + 55;
		bb = (i % 50) * 2;
		x[aa][bb] = true;
	}

	cout << n << " " << n << "\n";
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			if (!x[i][j]) cout << "#";
			else cout << ".";
		}
		cout << "\n";
	}

	return 0;
}


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

int main(){
  int a, b, c;
  cin >> a >> b >>c;
  int M = max({a,b,c});
  int m = min({a,b,c});
  int sec = a+b+c-M-m;
  cout << 10*M+sec+m << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,j,n,k,l,h,A[100][100];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j]=0;
    }
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&k,&l);
    for(j=0;j<l;j++){
      scanf("%d",&h);
      A[k-1][h-1]=1;
    }
  }

 for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j>0)printf(" ");
      printf("%d",A[i][j]);
    }
    printf("\n");
  }

 return 0;
  
}




Measured memory_bytes: 2112
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int ketanowa(int n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n = n / 10;
	}
	return sum;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

int main() {
	double x1,x2,y1,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << fixed << setprecision(6)<< sqrt(pow(x2-x1,2)+pow(y2-y1,2)) << endl;
	return 0;
}

Measured memory_bytes: 3264
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define _GLIBCXX_DEBUG

bool is_product_overflow(unsigned long a, unsigned long b) {
    unsigned long prod = a * b;

    return (prod / b != a);
}

int main(void){

    int N;
    cin >> N;
    vector<unsigned long> A(N);
    unsigned long R = 1;
    long C = 1000000000000000000;

    for(int i=0; i<N; i++){
      cin >> A.at(i);
      if(A.at(i)==0){
          cout << 0 << endl;
          return 0;
      }
    }

    for (int i = 0; i < N; i++) {
      
      if (is_product_overflow(R, A.at(i))){
        cout << -1 << endl;
        return 0;
      }

      R = R * A.at(i);
    }

    if (R > C) {
      cout << -1 << endl;
    }

    else{
        cout << R << endl;
    }
    


}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int h, w;
    cin >> h >> w;
    vvint a(h, vint(w));
    rep(i, h) rep(j, w) cin >> a[i][j];
    
    vvint ans;
    rep(i, h) rep(j, w) {
        if (a[i][j] % 2 == 0) continue;
        vint ans_t(4, 0);
        bool c = false;
        if (j < w-1) {
            a[i][j]--; 
            a[i][j+1]++;
            ans_t = {i+1, j+1, i+1, j+2}; 
            if (a[i][j+1] % 2 == 1) c = true;
        }
        else if (i < h-1 && c == false) {
            a[i][j]--; 
            a[i+1][j]++; 
            ans_t = {i+1, j+1, i+2, j+1}; 
        }
        if (ans_t[0] != 0) ans.push_back(ans_t);
    }

    int n = ans.size();
    cout << n << endl;
    rep(i, n) rep(j, 4) printf("%d%s", ans[i][j], j != 3 ? " " : "\n");
    
    return 0;
}

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

int f(int N) {
  int res = 0;
  while (N % 100 == 0) ++res, N /= 100;
  return res;
}

int main() {
  int D, N;
  cin >> D >> N;
  int con = 0, res = 0;
  for (int i = 1; i <= 10000000; ++i) {
    if (f(i) == D) ++con;
    if (con == N) {
      res = i;
      break;
    }
  } 
  cout << res << endl;
}
    

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

int main() {
  int a, b;
  cin >> a >> b;
  cout << (a-1)*(b-1) << endl;
  return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <sstream>
#include <numeric>
#include <complex>

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

#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define F first
#define S second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SZ(a) (int)((a).size())
#define ALL(a) a.begin(),a.end()
#define FOR(it,a) for(__typeof(a.begin())it=a.begin();it!=a.end();++it)


//低優先度


#include <list>
#include <stack>
#include <iomanip>
#include <fstream>
#include <cassert>
#define REP(i, n) rep (i, n)
#define min3(a,b,c) min((a),min((b),(c)))
#define min4(a,b,c,d) min((a),min3((b),(c),(d)))
#define FLL(a,b) memset((a),b,sizeof(a))
#define CLR(a) memset((a),0,sizeof(a))
#define EPS (1e-8)
template<class T,class U>ostream&operator<<(ostream&o,pair<T,U>&v){return o<<"("<<v.F<<","<<v.S<<")";}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){o<<"{";rep(i,SZ(v))o<<(i?",":"")<<v[i];return o<<"}";}
string i2s(int a){stringstream ss;ss<<a;return ss.str();};
typedef double FP;
typedef complex<FP> pt;
typedef pt P;
typedef pair<pt,pt> line;
FP dot(P a,P b){return real(conj(a)*b);}
FP crs(P a,P b){return imag(conj(a)*b);}
P ortho(P a){return a*P(0,1);}
P ortho(line a){return ortho(a.S-a.F);}
P crspt(P a,P b,P c,P d){b-=a,d-=c;return a+b*crs(d,c-a)/crs(d,b);}
P crspt(line a,line b){return crspt(a.F,a.S,b.F,b.S);}
bool onl(P a1,P a2,P b){return abs(b-a1)+abs(b-a2)<abs(a1-a2)+EPS;}
bool onl(line a,P b){return onl(a.F,a.S,b);}
bool iscrs(line a,line b){P c=crspt(a,b);return onl(a,c)&&onl(b,c);}
void pkuassert(bool t){t=1/t;};
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,-1,1,1,-1};
enum{TOP,BTM,LFT,RGT,FRT,BCK};
int dxdy2ce[]={RGT,FRT,LFT,BCK};
template<class T> T shift(T a,int b,int c,int d,int e){
 __typeof(a[0])t=a[b];a[b]=a[c];a[c]=a[d];a[d]=a[e];a[e]=t;
 return a;}
template<class T> T rgt(T a){return shift(a,TOP,LFT,BTM,RGT);}
template<class T> T lft(T a){return shift(a,TOP,RGT,BTM,LFT);}
template<class T> T frt(T a){return shift(a,TOP,BCK,BTM,FRT);}
template<class T> T bck(T a){return shift(a,TOP,FRT,BTM,BCK);}
line mkl(P a,P v){return line(a,a+v);}
FP lpdist(line a,P b){return abs(b-crspt(a,mkl(b,ortho(a))));}
FP spdist(line a,P b){
  P c(crspt(a,mkl(b,ortho(a))));
  return onl(a,c)?abs(b-c):min(abs(a.F-b),abs(a.S-b));
}
FP ssdist(line a,line b){
 return
  iscrs(a,b)?0.:
   min4(spdist(a,b.F),spdist(a,b.S),
        spdist(b,a.F),spdist(b,a.S));
}
namespace std{
  bool operator<(const P&a,const P&b){
    return mp(real(a),imag(a))<mp(real(b),imag(b));
  }
}

int main(int argc, char *argv[])
{
  int a,b;
  ofstream fout("out.txt");
  if(fout){
    rep(i,9)rep(j,9) printf("%dx%d=%d\n",i+1,j+1,(i+1)*(j+1));
    fout << a+b << endl;    
  }

  return 0;
}

Measured memory_bytes: 1220
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n, l;
    scanf("%d%d", &n, &l);
    int min = 1000000, sum = 0;
    int i, k;
    for (i = 0; i < n; i++)
    {
        sum += l + i;
    }
    for (i = 0; i < n; i++)
    {
        if (abs(l + i) <= min)
        {
            if (l + i < 0)
            {
                k = 1;
            }
            else
            {
                k = 0;
            }
            min = abs(l + i);
        }
    }
    if (k == 0)
    {
        printf("%d\n", sum - min);
    }
    else
    {
        printf("%d\n", sum + min);
    }
    return 0;
}

Measured memory_bytes: 128