akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	sc := NewScanner()
	S := sc.Next()
	if S[len(S)-1] == 's' {
		fmt.Println(S + "es")
	} else {
		fmt.Println(S + "s")
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1780
// Shift only

#include <iostream>

using namespace std;

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

	int res = 0;
	bool missflag = false;

	while(1){
		for (int i = 0; i < N; ++i){
			if (A[i] % 2){
				missflag = true;
				break;
			}else{
				A[i] /= 2;
			}
		}
		if (missflag)
			break;
		else
			res++;
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
n=int(input())
s=[ str(input()) for _ in range(n)]
ans=0
a=0
b=0
ab=0
for i in range(n):
    for j in range(len(s[i])-1):
        if s[i][j:j+2]=="AB":
            ans+=1
#print(ans)
for i in range(n):
    if s[i][0]=="B" and s[i][-1]=="A":
        ab+=1
    elif s[i][0]=="B":
        b+=1
    elif s[i][-1]=="A":
        a+=1

ma=max(a,b)
mi=min(a,b)
if 1<=a :
    ans+=ab
else:
    if 1<=ab:
        a+=1
        ab-=1
        ans+=ab

ans+=min(a,b)

#print(a,b,ab)
print(ans)

Measured memory_bytes: 3700
#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
	int N;
	cin >> N;

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

    sort(p,p+N);
	
    int max_p = p[N-1];

    int sum=0;

    for(int i=0; i<N; i++){
        sum += p[i];
    }

    cout << sum-int(max_p/2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define NIL 3000000000;
using namespace std;

class maximumHeap{
public:
  int size;
  long long int* heap;
  maximumHeap(int size){
    this->size = size;
    heap = new long long int[size+1];
    for(int i=1; i<=size; i++) heap[i]=NIL;
  }
  ~maximumHeap(){
    delete[] heap;
  }

  void buildMaxHeap(){
    for(int i=size/2; i>=1; i--){
      maxHeapify(i);
    }
  }

  void print(){
    for(int i=1; i<=size; i++){
      cout << " " << heap[i];
    }
    cout << endl;
  }
private:
  void  maxHeapify(int i){
    int l=i*2, r=i*2+1;
    int largest=i;

    if(l<=size){
      if(heap[l]>heap[i]) largest = l;
    }
    else largest = i;

    if(r<=size){
      if(heap[r]>heap[largest]) largest = r;
    }

    if(largest!=i){
      long long int temp=heap[i];
      heap[i]=heap[largest];
      heap[largest]=temp;
      maxHeapify(largest);
    }
  }
};

int main(){
  int n; cin >> n;
  maximumHeap mh(n);

  int v;
  for(int i=0; i<n; i++){
    cin >> v;
    mh.heap[i+1] = v;
  }

  mh.buildMaxHeap();

  mh.print();

  return 0;
}



Measured memory_bytes: 6788
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int[] array = new int[4];
		for(int i = 0; i < 4; i++) array[i] = sc.nextInt();
		System.out.println(Math.min(array[0], array[1]) + Math.min(array[2], array[3]));
	}
}


Measured memory_bytes: 21844
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()


x = 0
k = readInt()
a = 7%k
ans = 0
for i in range(10**6+1):
	x = (x*10%k+a)%k
	ans += 1
	if x==0:
		print(ans)
		exit()

print(-1)

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

int N;
string S;
vector<char> A = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};

int main() {
  cin >> N >> S;
  for (int i = 0; i < S.size(); i++){
    for (int j = 0; j < 26; j++){
      if(S.at(i) == A.at(j)){
        S.at(i) = A.at(j+N);
        break;
      }
    }
  }
  cout << S << endl;
}

Measured memory_bytes: 256
program main;
var
  n, i, a : LongInt;
  cnt : array[1..200000] of LongInt;
begin
  for i := 1 to n do
    cnt[i] := 0;

  readln(n);
  for i := 2 to n do begin
    read(a);
    cnt[a] := cnt[a] + 1;
  end;

  for i := 1 to n do
    writeln(cnt[i]);
end.

Measured memory_bytes: 1396
using System;

public class hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        var map = new int[h + 1, w + 1];
        for (int i = 0; i < h; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < w; j++) map[i + 1, j + 1] = int.Parse(line[j]);
        }
        for (int i = 1; i < h + 1; i++)
            for (int j = 1; j < w + 1; j++)
                map[i, j] = map[i, j - 1] + map[i, j];
        for (int i = 1; i < w + 1; i++)
            for (int j = 1; j < h + 1; j++)
                map[j, i] = map[j, i] + map[j - 1, i];
        var ans = getAns(map, h + 1, w + 1);
        Console.WriteLine(ans);
    }
    static long getAns(int[,] map, int h, int w)
    {
        var ans = 0L;
        for (long i = 1; i < h; i++)
            for (long j = 1; j < w; j++)
            {
                ans += map[i, j] * i * j
                        + map[i - 1, j - 1] * (h - 1 - (i - 1)) * (w - 1 - (j - 1))
                        - map[i, j - 1] * i * (w - 1 - (j - 1))
                        - map[i - 1, j] * (h - 1 - (i - 1)) * j;
            }
        return ans;
    }
}


Measured memory_bytes: 22544
using System;
using System.Linq;
using System.Collections.Generic;




namespace ConsoleApplication1 {

    

    class ClassMain {



        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                //int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                //int n = ints[0];
                int n = int.Parse(line);                
                if (n == 0) { break; }

                for (int i = 0; i < n; i++) {
                    int t = int.Parse(Console.ReadLine());
                    int[] blocks = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                    int maxNobori = 0;
                    int maxOri = 0;
                    for (int j = 0; j < t - 1; j++) {
                        int sa = blocks[j + 1] - blocks[j];
                        if (sa > 0) { maxNobori = Math.Max(maxNobori, sa); }
                        if (sa < 0) { maxOri = Math.Min(maxOri, sa); }
                    }
                    
                    Console.WriteLine(maxNobori+" "+(-1*maxOri));
                }
                
                    
              //Console.WriteLine();
                    
                



            }
        }
    }
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  cout << (int)pow(floor(sqrt(in())), 2) << endl;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> ans = {
        61,        230,       865,       3247,      12185,     45719,
        171531,    643550,    2414454,   9058467,   33985227,  127504505,
        478366600, 794717734, 733354121, 261943303, 776803305, 580025381,
        51688048,  44657419,  737209731, 604119499, 159693437, 858533109,
        639056669, 549054109, 996291083, 531294469, 23314687,  783022045,
        855462856, 649970414, 68697295,  409213624, 604356692, 88638656,
        978442997, 534833116, 763737161, 785892908, 123883652, 639213333,
        181836645, 998121103, 124885216, 501575626, 39816123,  113468411,
        799008836, 775465589, 256852905, 664630886, 971550783, 751629411,
        51018086,  702530485, 725438992, 696683714, 792638194, 221791721,
        149602322, 414054379, 986519078, 981760191, 305799096, 515140586,
        406959393, 975058685, 245601370, 324759692, 673385295, 191483611,
        570246669, 427196161, 781042769, 569725155, 842176273, 25328739,
        847501730, 206282374, 353770801, 323137024, 371653459, 940737264,
        123820509, 915711339, 847205021, 252858375, 718889563, 866398347,
        738390145, 133009077, 333099663, 170591295, 329869205, 616680192,
        597534442, 388130742};
    cout << ans[n - 3] << endl;
}

Measured memory_bytes: 256
import scala.io.Source.stdin

object Main extends App {
  stdin.getLines.foreach { s =>
    val n = s.split(" ").map(_.toDouble)
    val a = n(2)-n(0);val b = n(3)-n(1);val c = n(6)-n(4);val d = n(7)-n(5)
    if( Math.abs((a*c)+(b*d)) < 0.0000000001) println("YES") else println("NO")
  }
}

Measured memory_bytes: 44088
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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;
}
const int MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N);
    rep(i, 0, N) { cin >> A[i]; }
    rep(i, 0, N) { cin >> B[i]; }
    rep(i, 0, N - 1) { cin >> C[i]; }
    int res = 0;
    int tmp = -5;
    rep(i, 0, N) {
        int r = A[i] - 1;
        res += B[r];
        if(r == tmp + 1) {
            res += C[tmp];
        }
        tmp = r;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <array>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

constexpr int64_t inf = (1ll << 60);

int main() {
  int N;
  int A, B;
  std::cin >> N >> A >> B;
  std::vector<int> P(N);
  for (int &x: P) {
    std::cin >> x;
  }
  std::array<std::vector<int64_t>, 2> dp;
  dp.fill(std::vector<int64_t>(N + 1, inf));
  dp[0][0] = 0;
  for (int i = 0; i < N; ++i) {
    auto &cur = dp[i & 1];
    auto &next = dp[(i & 1) ^ 1];
    for (int j = 0; j <= N; ++j) {
      if(j < P[i]) {
        chmin(next[j], cur[j] + A);
        chmin(next[P[i]], cur[j]);
      }
      if(j > P[i]) {
        chmin(next[j], cur[j] + B);
      }
      cur[j] = inf;
    }
  }
  auto &ans = dp[N & 1];
  std::cout << *std::min_element(ans.begin(), ans.end()) << '\n';
  return 0;
}


Measured memory_bytes: 384
from collections import Counter

N = int(input())
balls = [tuple(map(int, input().split())) for _ in range(N)]

if N == 1:
    ans = 1
else:
    diffs = Counter()
    for i in range(N):
        x1, y1 = balls[i]
        for j in range(N):
            if i == j: continue
            x2, y2 = balls[j]
            diffs.update([(x2-x1, y2-y1)])
    ans = N - diffs.most_common(1)[0][1]

print(ans)


Measured memory_bytes: 3828
import java.util.Comparator;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Arrays;
	/* static int java.util.Arrays.binarySearch(int[] a, int key); */
import java.math.BigDecimal;
	



public class Main {
	Scanner sc = new Scanner(System.in);
	int n;
	String s;
	public void run(){
		n = sc.nextInt();
		s = sc.next();
		solve();
	}
	public void solve(){
		int muki[] = new int[n];
		int ep[] = new int[n]; //e[i]:iがリーダのとき、東を向かなければいけない人の数=リーダより左にいて西を向いている人
		int wp[] = new int[n]; //w[i]:iがリーダのとき、西を向かなければ行けない人の数=リーダより右にいる東を向いている人
		
		for(int i = 0; i < n; i++){
			String now = s.substring(i,  i+1);
			if(now.equals("W")){
				muki[i] = -1;
			}
			else{
				muki[i] = 1;
			}
		}
		
		for(int i = 1; i < n; i++){
			if(muki[i-1] == -1){
				ep[i] = ep[i-1] + 1;
			}
			else{
				ep[i] = ep[i-1];
			}
			
			if(muki[n-i] == 1){
				wp[n-i-1] = wp[n-i] + 1;
			}
			else{
				wp[n-i-1] = wp[n-i];
			}
		}
		
		int ans = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++){
			if(ans > ep[i] + wp[i]){
				ans = ep[i] + wp[i];
			}
		}
		
		System.out.println(ans);
	}
	
	public static void main(String[] args){
		new Main().run();
	}
	
	static class Pair {
        int first,second;
        public Pair(int a,int b) {
            this.first = a;
            this.second = b;
        }
    }
	static class Edge{
		int to, cost;
		public Edge(int a, int b){
			this.to = a;
			this.cost = b;
		}
	}
	class MyComparator implements Comparator {
		@Override
		public int compare (Object arg0, Object arg1) {
			int x = ((Pair)arg0).first;
			int y = ((Pair)arg1).first;
			
			if (x < y) {
				return 1;
			} else if (x > y) {
				return -1;
			} else{
				return 0;
			}
		}
	}
	static class UnionFind{
		int par[];
		int rank[];
		
		//n要素で初期化
		public UnionFind(int maxn){
			par = new int[maxn];
			rank = new int[maxn];
			
			for(int i = 0; i < maxn; i++){
				par[i] = i;
				rank[i] = 0;
			}
		}
		
		//木の根を求める
		int find(int x){
			if(par[x] == x){
				return x;
			}
			else {
				return par[x] = find(par[x]);
			}
		}
		
		// xとyの属する集合を併合
		void unite (int x, int y){
			x = find(x);
			y = find(y);
			if(x == y){
				return;
			}
			
			if(rank[x] < rank[y]){
				par[x] = y;
			}
			else{
				par[y] = x;
				if(rank[x] == rank[y]) rank[x]++;
			}
		}
		
		// xとyが同じ集合に属するか否か
		boolean same(int x, int y){
			return find(x) == find(y);
		}
	}
	
}


Measured memory_bytes: 45368
#include<stdio.h>
#include<string.h>
int main(void){
    char s[101];
    scanf("%s",s);
    int a=strlen(s),ans=0;
    for(int i=0;a/2>i;++i){
        if(s[i]!=s[a-1-i])
        ++ans;
    }
    printf("%d",ans);
    return 0;
}

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

#define ll long long
#define ar array

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

    vector <int> height(no_of_stones + 1, 0);
    for(int i = 1; i <= no_of_stones; i++)
        cin >> height[i];

    vector <int> minimum_cost(no_of_stones + 1);
    minimum_cost[2] = abs(height[2] - height[1]);
    for(int i = 3; i <= no_of_stones; i++)
        minimum_cost[i] = min(minimum_cost[i - 1] + abs(height[i] - height[i - 1]),
                              minimum_cost[i - 2] + abs(height[i] - height[i - 2]));

    cout << minimum_cost[no_of_stones];
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int a, b, c;
	cin >> a >> b >> c;
	if (c >= a && c <= b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

using namespace std;

typedef long long ll;

// Scan and Debug
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F f, R... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

const int MAX = 51;
int n, tot = 0,
		v[MAX], c[MAX];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	scan(n);

	for (int i = 0; i < n; ++i)
		scan(v[i]);
	for (int i = 0; i < n; ++i)
		scan(c[i]);

	for (int i = 0; i < n; ++i) {
		int dif = v[i] - c[i];
		if (dif > 0)
			tot += dif;
	}

	cout << tot << "\n";

	return 0;
}


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

using namespace std;
int main(){
    int n,x=0,max=0;
    string s;
    cin>>n>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]=='I'){
            x++;
            if(max<x)max=x;
        }
        else x--;
    }
    cout<<max<<endl;
    return 0;
}

Measured memory_bytes: 256
/**
 * B - Shift only
 */

#include <iostream>

using namespace std;

int main() {
    int N, count = 32;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int A, count_ = 0;
        cin >> A;
        while (A % 2 == 0) {
            count_++;
            A /= 2;
        }
        count = min(count, count_);
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main() {
	
	double a,b,c,d,e,f,x,y;
	
	while(cin>>a>>b>>c>>d>>e>>f){
		printf("%.3f %.3f\n",floor((e*c-b*f)/(a*e-b*d)*1000+0.5)/1000,floor((a*f-c*d)/(a*e-b*d)*1000+0.5)/1000);		
	}
	
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+100;
typedef long long ll;

ll a[maxn];
map<ll,ll> p;

int main()
{
    int N;
    cin>>N;
    p[0]=1;
    ll ans=0,sum=0;
    for(int i=1;i<=N;i++){
        cin>>a[i];
        sum+=a[i];
        ans+=p[sum];
        p[sum]++;
    }
    cout<<ans<<endl;
    return 0;
}


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


int main(){
	int w,h;
	cin >> h >> w;
	while (w !=0 && h!=0){
        for(int i=0; i<h; i++){
            for(int j=0; j<w;j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
        cin  >> h  >> w;
	}
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    cout << fixed << setprecision(10);
    cout << (double)((n + 1) / 2) / n << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;

/**
 * @author zhangyong1@oneship.cc
 */
public class Main {

    public static void main(String[] args) {
        String letter =
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String str = in.next();
        HashMap<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < letter.length(); i++) {
            map.put(letter.charAt(i), i);
        }
        for (int i = 0; i < str.length(); ++i) {
            System.out.print(letter.charAt((map.get(str.charAt(i)) + n) % 26));
        }
        System.out.println();
    }
}


Measured memory_bytes: 26576
n = int(input())
h = list(int(i) for i in input().split())
dp = list(0 for i in range(n))
num = list(range(n))
num = sorted(num, reverse=True)
for i in num:
    if i==n-1:
         dp[i]=0
    elif i==n-2:
         dp[i]=abs(h[n-1]-h[n-2])
    else:
         dp[i] = min(abs(h[i+2]-h[i])+dp[i+2], abs(h[i+1]-h[i])+dp[i+1])
print(dp[0])

Measured memory_bytes: 15288
# -*- coding: utf-8 -*-
a,b,k=map(int ,input().split())

if a+k<b-k+1:
    for i in range(a,a+k):
        print(i)

    for i in range(b-k+1,b+1):
        print(i)

else:
    for i in range(a,b+1):
        print(i)

"""
3 8 2

3
4
7
8

4 8 3

4
5
6
7
8

2 9 100

2
3
4
5
6
7
8
9
"""

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;

 ll mod=1e9 +7;
const ll M=500006;
ll f[M],inv[M];
ll expo(ll base,ll exponent){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

vector<bool>  prime(1000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=1000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=1000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt
    // freopen("alchemy_input.txt", "r", stdin);
 //    // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
 //    #endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // compute();
    ll tests=1,t=1;
   // cin>>tests;
    while(tests--)
    {
    	ll i,j,n;
    	cin>>n>>j;
    	ll ans=0;
    	while(n--)
    	{
    		ll x,y;
    		cin>>x>>y;
    		if(sqrt(x*x + y*y)<=j) ans++;
    	}
    	cout<<ans;
    }

	return 0;
}

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

using namespace std;

int main() {
    int a, b, k; cin >> a >> b >> k;
    vector<int> ans;
    for(int i = a; i <= b; ++i) {
        if(i < a+k || i > b-k) ans.push_back(i);
    }
    sort(ans.begin(), ans.end());
    for(auto hoge : ans) {
        cout << hoge << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
#include<math.h>

using namespace std;

typedef long long ll;
typedef pair<long long, long long> pll;

int l_count(vector<int> v, vector<vector<int>> F, int s){
	s = s - 1;
	if (v.size() == 1){
		return 1;
	}
	int c = 0;
	for (auto t : F[s]){
		c += count(v.begin(), v.end(), t);
	}
	if (c == 0){
		return 0;
	}
	int ret = 0;
	vector<int> u = v;
	u.erase(remove(u.begin(), u.end(), s+1), u.end());
	for (auto t : F[s]){
		if (count(v.begin(), v.end(), t) == 1){
			ret += l_count(u, F, t);
		}
	}
	return ret;
}

int main(){
	int N, M;
	int i, j, k;
	cin >> N >> M;
	vector<int> v;
	for (i = 1; i <= N; i++){
		v.push_back(i);
	}
	vector<pair<int, int>> E;
	for (i = 0; i < M; i++){
		int a, b;
		cin >> a >> b;
		E.push_back(pair<int, int>(a, b));
	}
	vector<vector<int>> F;
	for (i = 1; i <= N; i++){
		vector<int> G;
		for (j = 1; j <= N; j++){
			pair<int, int> g(i, j);
			pair<int, int> h(j, i);
			if (count(E.begin(), E.end(), g) == 1 || count(E.begin(), E.end(), h) == 1){
				G.push_back(j);
			}
		}
		F.push_back(G);
	}
	int ans = l_count(v, F, 1);

	cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <vector>
#include <numeric>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool a)
{
    if (a == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    int lm = 0, rm = INF;
    int l, r;
    rep(i, 0, m)
    {
        cin >> l >> r;
        lm = max(lm, l);
        rm = min(rm, r);
    }
    cout << max(0, rm - lm + 1) << endl;
}


Measured memory_bytes: 256
while(1):
    m=int(input())
    if m==0:    break
    #root, before, next, top, rank
    A=[[i for i in range(m+1)],[0 for i in range(m+1)],[0 for i in range(m+1)],[i for i in range(m+1)],[1 for i in range(m+1)]]
    
    while(1):
        I,J=map(int, input().split())
        if I==0:    break
        if I==J:
            pass
        else:
            srcroot=A[0][I]
            dstroot=A[0][J]
            srcrank=A[4][I]
            dstrank=A[4][J]
            if srcroot==dstroot and srcrank>dstrank:
                pass
            elif A[1][I]==0 and J==0:
                pass
            else:
                k=I
                while(A[2][k]!=0):
                    A[2][k],k=0,A[2][k]
                    if J==k: dstroot=J
                    A[0][k]=k
                    A[1][k]=0
                    A[3][k]=k
                    A[4][k]=1
                A[3][srcroot]=A[1][I]
                prevtop=A[3][dstroot]
                A[3][dstroot]=I
                A[0][I]=dstroot
                A[1][I]=prevtop
                A[2][I]=0
                A[3][I]=I
                A[4][I]=A[4][prevtop]+1
                A[2][prevtop]=I
                if J==0:
                    A[0][I]=I
                    A[1][I]=0
                    A[2][I]=0
                    A[3][I]=I
                    A[4][I]=1
                    
    ans=[0 for x in range(m+1)]
    for i in range(1,m+1):
        root=A[0][i]
        rank=A[4][i]
        ans[root]=max(ans[root], rank)
    ans=sorted(ans)
    #print(ans)
    #print(A)
    for a in ans:
        if a!=0: print (a)
    print("end")


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64_t a,b,k; cin>>a>>b>>k;
  if(a>=k) cout<<a-k<<' '<<b;
  else if(b>=k-a) cout<<0<<' '<<b-(k-a);
  else cout<<0<<' '<<0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
    ll N, i, j, k, ans;
    string str;
    string march = "MARCH";
    map<char, ll> mp;

    cin >> N;


    for (i = 0; i < N; i++)
    {
        cin >> str;
        if (str[0] == 'M' || str[0] == 'A' || str[0] == 'R' || str[0] == 'C' || str[0] == 'H')
        {
            mp[str[0]]++;
        }
    }

    ans = 0;

    for (i = 0; i < 5; i++)
    {
        for (j = 0; j < 5; j++)
        {
            for (k = 0; k < 5; k++)
            {
                if (march[i] != march[j] && march[j] != march[k] && march[k] != march[i])
                    ans += mp[march[i]] * mp[march[j]] * mp[march[k]];
            }
        }
    }

    cout << ans / 6 << endl;

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  int s = 0;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    s += r - l + 1;
  }
  cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <numeric>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define itr(i, x) for(auto i = (x).begin(); i != (x).end(); i++)
#define ritr(i, x) for(auto i = (x).rbegin(); i != (x).rend(); i++)
#define INF 1010101010
#define MOD 1000000007
#define LL long long
using Coord = pair<int, int>;

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> sn(n);
    for (auto& e: sn) cin >> e;
    sort(all(sn));
    for (const string& e: sn) cout << e;
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<long long> a(N),b(N),t_b(N),c(N);
  REP(i,N){
    cin >> a[i];
  }
  REP(i,N){
    cin >> b[i];
  }
  REP(i,N){
    cin >> c[i];
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  ull ans = 0;
  REP(i,N){
    int a_i = lower_bound(a.begin(), a.end(), b[i]) - a.begin() - 1;
    t_b[i] = a_i + 1;
  }
  REP(i,N-1){
    t_b[i+1] += t_b[i];
  }
  REP(i,N){
    int b_i = lower_bound(b.begin(), b.end(), c[i]) - b.begin() - 1;
    if(b_i < 0) continue;
    ans += t_b[b_i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3456
def spaceinput():
    return list(map(int,input().split(" ")))

def rotate(s):
    return s[-1]+s[:-1]

s=input()
s2=input()

def chk(s,s2):
    for i in range(len(s)):
        #print(s2)
        if s==s2:
            return True
        s2=rotate(s2)

    return False

if chk(s,s2):
    print("Yes")
else:
    print("No")


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

int main() {
    int n, m, capi_x, capi_y;
    string ans;
    cin >> n >> m >> capi_x >> capi_y;
    vector<int> empire_x, empire_y;
    empire_x.push_back(capi_x);
    empire_y.push_back(capi_y);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        empire_x.push_back(x);
    }
    for (int i = 0; i < m; i++) {
        int y;
        cin >> y;
        empire_y.push_back(y);
    }
    sort(empire_x.begin(), empire_x.end());
    sort(empire_y.begin(), empire_y.end());
    if (empire_x.back() < empire_y.front())
        ans = "No War";
    else ans = "War";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N_MAX 100
#define sz stack.size()
using namespace std;
typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment
const double EPS = 1e-8;
vector<P> v;
double x,y;
int n,ans;
P a;

namespace std {
  bool operator < (const P& a, const P& b){
    return fabs(real(a)-real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(b);
  }
}
 
double cross(P a, P b){ return imag(conj(a)*b); }

double dot(P a, P b){ return real(conj(a)*b); }

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;   // テ」ツδ凖」ツつッテ」ツδ暗」ツδォ(b-a)テ」ツ?ョテ・ツキツヲテ・ツ?エテ」ツ?ォテ」ツδ凖」ツつッテ」ツδ暗」ツδォ(c-a)テ」ツ?古・ツュツ佚・ツ慊ィテ」ツ?凖」ツつ凝」ツ??
  if(cross(b,c) < -EPS) return -1; // テ」ツδ凖」ツつッテ」ツδ暗」ツδォ(b-a)テ」ツ?ョテ・ツ渉ウテ・ツ?エテ」ツ?ォテ」ツδ凖」ツつッテ」ツδ暗」ツδォ(c-a)テ」ツ?古・ツュツ佚・ツ慊ィテ」ツ?凖」ツつ凝」ツ??
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

vector<P> convex_hull2(vector<P> ps) {
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end());
  vector<P> ch(2*n);
  for (int i = 0; i < n; ch[k++] = ps[i++]) // lower-hull
    while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
  for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--]) // upper-hull
    while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
  ch.resize(k-1);
  return ch;
}

bool isIntersectSP(L s, P p){ 
  return abs(s.first-p) + abs(s.second-p) - abs(s.second-s.first) < EPS; 
}

int main(){
  while(1){
    cin>>n;
    if(!n)break;
    for(int i=0;i<n;i++){
      scanf("%lf,%lf",&x,&y);
      a.real()=x;
      a.imag()=y;
      v.push_back(a);
    }
    ans=0;
    vector<P> r=convex_hull2(v);
    for(int i=0;i<n;i++){
      int f=0;
      for(int j=0;j<r.size();j++)
	if(isIntersectSP(L(r[j],r[(j+1)%r.size()]),v[i]))f=1;
      if(!f)ans++;
    }
    cout<<ans<<endl;
    v.clear();
  }
  return 0;
}

Measured memory_bytes: 1304
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) x.begin(),x.end()
#define db(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, n, m) for(int i = n; i >= m; i--)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int main(){

  string S;
  cin >> S;

  ll MOD=1000000007;

  ll dp[2][13]={};
  dp[0][0]=1;

  int lens=S.length();

  int ama=0;
  int keta=0;
  int ct=0;


  rep(i,lens){
    char c=S[lens-i-1];
    int x=ctoi(c);
    if(i==0){
      keta=1;
    }
    else {
      keta=(keta*10)%13;
    }
//    if(x!=-1){
//      ama=(ama+(x*keta))%13;
//    }
//    else{
      ct=1-ct;
      rep(j,13){
        dp[ct][j]=0;
      }
      rep(j,13){
        rep(k,10){
          if(x!=-1&&k!=x) continue;
          dp[ct][(j+keta*k)%13]=(dp[ct][(j+keta*k)%13]+dp[1-ct][j])%MOD;
        }
      }
    }


//  cout << dp[ct][(ama+5)%13] <<endl;
  cout << dp[ct][5] <<endl;
  return 0;
}


Measured memory_bytes: 512
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define P pair<int,int>
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
//cout << setprecision(123);
int main(){
  int N,n=0,k=0,l=0,m=0;
  cin>>N;
  vector<string>v(N);

  REP(i,N){
    string s;
    cin>>s;
    v[i]=s;
  }

  REP(i,N){
    if(v[i][0]=='B'){
      k++;
    }
    if(v[i].at(v[i].size()-1)=='A'){
      l++;
    }
    if(v[i][0]=='B' && v[i].at(v[i].size()-1)=='A')
      m++;
    }

  REP(i,N){
    REP(j,v[i].size()-1){
      if(v[i][j]=='A' && v[i][j+1]=='B'){
        n++;
        j++;
      }
    }
  }
  
  if(k==0 && l==0){
    cout <<n<<endl;
  }
  
 else if(k==m && l==m){
    cout<<n+min(k,l)-1<<endl;
  }
  
  else{
  cout <<n+min(k,l)<<endl;
 }
}

Measured memory_bytes: 768
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int s(int x) {
  int r = 0;
  while(x) {
    r += x%10;
    x/=10;
  }
  return r;
}

int main() {
  int n;
  scanf("%d", &n);
  if(n%s(n) == 0) printf("Yes\n");
  else printf("No\n");
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		String N = sc.next();
		
		int keta=N.length();
		int Nnum=Integer.parseInt(N);
		int total=0;
		
		for(int i=1;i<=Nnum;i++) {
			if(String.valueOf(i).length()%2==1) {
				total++;
			}
		}
		out.print(total);
		out.flush();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntsN(int N) {
		int[] ints = new int[N];
		for (int i = 0; i < N; i++) {
			ints[i] = nextInt();
		}
		return ints;
	}
	
	public long[] nextLongsN(int N) {
		long[] longs = new long[N];
		for (int i = 0; i < N; i++) {
			longs[i] = nextLong();
		}
		return longs;
	}
	
	public char[] nextCharsN(int N) {
		char[] chars = new char[N];
		String msg=next();
		for (int i = 0; i < N; i++) {
			chars[i] = msg.charAt(i);
		}
		return chars;
	}

	public char[][] nextCharsHW(int H, int W) {
		char[][] chars = new char[H][W];
		for (int i = 0; i < H; i++) {
			String str = next();
			for (int j = 0; j < W; j++) {
				chars[i][j] = str.charAt(j);
			}
		}
		return chars;
	}

	public int[][] nextIntsNM(int N, int M) {
		int[][] ints = new int[N][M];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < M; j++) {
				ints[i][j] = nextInt();
			}
		}
		return ints;
	}
}


Measured memory_bytes: 25940
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
from fractions import gcd

input = sys.stdin.readline

def main():
    N, X = map(int, input().split())
    x = [int(e) for e in input().split()]
    x.sort()

    if N == 1:
        print(abs(x[0] - X))
        return

    m = []
    for i in range(N-1):
        if x[i] < X and X < x[i+1]:
            m.append(x[i+1] - X)
            m.append(X - x[i])
        else:
            m.append(x[i+1]-x[i])
    
    n = m[0]
    for i in m:
        n = gcd(n, i)
    print(n)

main()


Measured memory_bytes: 16276
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    fastcin();

    int n;
    cin >> n;
    string s, t;
    cin >>s >> t;
    string a;
    rep(i, n){
        a += s[i];
        a += t[i];
    }
    cout << a << endl;
}

Measured memory_bytes: 256
import sys
import math


def score(A, Q):
    q = len(Q)
    res = 0
    for i in range(q):
        if A[Q[i][1]] - A[Q[i][0]] == Q[i][2]:
            res += Q[i][3]
    return res


def calc(k, A, n, m, Q):
    if k == n:
        s = score(A, Q)
        return s

    start = 1
    if k >= 1:
        start = A[k - 1]

    res = 0
    for i in range(start, m + 1):
        A[k] = i
        res = max(res, calc(k + 1, A, n, m, Q))

    return res


def main():
    input = sys.stdin.readline

    n, m, q = (int(i) for i in input().split())
    Q = []
    for i in range(q):
        a, b, c, d = (int(i) for i in input().split())
        Q.append((a - 1, b - 1, c, d))

    A = [1 for i in range(n)]
    res = calc(0, A, n, m, Q)

    print(res)


main()


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

#define _USE_MATH_DEFINES
//BIAR MANTAB LAH YA
#define Willy using
#define Indrayana namespace
#define Komara std
 
Willy Indrayana Komara;

using ll = long long int;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int input;
        cin >> input;
        n -= input;
    }
    if (n < 0) n = -1;
    cout << n << '\n';
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	int n;
	cin >> n;
	vl a(n);
	rep(i,0,n) {
		cin >> a[i];
	}
	int i = 0;
	int j = 0;
	ll ret = 0;
	ll A = 0;
	while(i<n) {
		if(j == n) {
			ret += j - i;
			//cout << i << ", " << j << "->" << ret << '\n';
			i++;
			continue;
		} else if(i==j) {
			A = a[i];
			j++;
			continue;
		}
		
		if(A & a[j]) {
			ret += j - i;
			//cout << i << ", " << j << "->" << ret << '\n';
			A = A & (~a[i]);
			i++;
		} else {
			A = A | a[j];
			j++;
		}
	}
	cout << ret << '\n';
	return 0;
}


Measured memory_bytes: 1792
using System;
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*b)%2 == 0)
    {
      Console.WriteLine("Even");
    }else{
      Console.WriteLine("Odd");
    }
    
  }
}

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

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

    int ans = 0;
    int h;
    for (int i = 0; i < n; ++i){
        cin >> h;
        if (k<=h){
            ans+=1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256