akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
#include <numeric>
#include <sstream>
using namespace std;
typedef long long ll;
#define DEBUG
#ifdef DEBUG
	#define debug printf
#else
	#define debug(...)
#endif
const int maxn = 5e5 + 5;
const int maxm = maxn - 5;
const int mod = 998244353;
ll f[maxn],invf[maxn];
ll mypow(ll a,ll b)
{
	ll res = 1;
	for(;b;b >>= 1,a = a * a % mod)
	{
		if(b & 1)
		{
			res = res * a % mod;
		}
	}
	return res;
}
ll n,m,ans;
void init()
{
	f[0] = 1;
	for(int i = 1;i <= n; ++i)
	{
		f[i] = f[i - 1] * i % mod;
	}
	invf[n] = mypow(f[n],mod - 2);
	for(int i = n - 1;i >= 0; --i)
	{
		invf[i] = invf[i + 1] * (i + 1) % mod;
	}
}
ll comb(ll n,ll k)
{
	if(n < 0 || k < 0 || n < k)
	{
		return 0;
	}
	return f[n] * invf[k] % mod * invf[n - k] % mod;
}
int main(int argc, char const *argv[])
{
	scanf("%lld%lld",&n,&m);
	if(n < m)
	{
		swap(n,m);
	}
	init();
	for(int k = 0;k <= m; ++k)
	{
		ll fg = k & 1 ? -1 : 1;
		ans += fg * comb(n,k) % mod * comb(m,k) % mod * f[k] % mod
				* mypow(m + 1,n - k) % mod * mypow(n + 1,m - k) % mod;
		ans %= mod;
		ans = (ans + mod) % mod;
	}
	printf("%lld\n",ans);
	return 0;
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(long long i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

  
int main() {
int r, g, b;
cin >> r >> g >> b;

int ans = 100 * r + 10 * g + b;
if(ans % 4 == 0) YES;
else NO;


}


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

int main(){
	int l, o, t, j, L, s, z;
	cin >> l >> o >> t >> j >> L >> s >> z;
	ll an = o;
	int k = (l & 1) + (j & 1) + (L & 1);
	if (k >= 2 && l > 0 && L > 0 && j > 0)an += 3, --l, --L, --j;	
	an += (ll)l / 2 * 2 + j / 2 * 2 + L / 2 * 2;
	printf("%lld\n", an);
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());
		int[] a = new int[N];
		int idx;
		for (idx = 0; idx < N; idx++) {
			a[idx] = Integer.parseInt(sc.next());
		}

		boolean ansFlg = true;

		int i;
		int ballSum = 0;
		int ballNum = 0;
		int[] ballIdx = new int[N];

		int[] balls = new int[N];
		for (i = N; i >= 1; i--) {
			// 上から決める

			ballSum = 0;
			// 自分より上で倍数のボール総和
			for (idx = i * 2; idx <= N; idx += i) {
				ballSum += balls[idx - 1];
			}

			if (ballSum % 2 == 0) {
				// 自身と同じ数
				if (a[i - 1] == 1) {
					ballIdx[ballNum] = i; // 1始まり
					++ballNum;
					balls[i - 1] = 1;
				} else {
					balls[i - 1] = 0;
				}
			} else {
				if (a[i - 1] == 1) {
					// 自身が1なら解なし
//					ansFlg = false;
//					break;
					balls[i - 1] = 0;
				} else {
					// 自身が0なら入れる
					ballIdx[ballNum] = i; // 1始まり
					++ballNum;
					balls[i - 1] = 1;
				}
			}
		}

		if (ansFlg) {
			System.out.println(ballNum);
			if (ballNum > 0) {
				// 逆順に出力
				boolean initial = true;
				for (idx = ballNum - 1; idx >= 0; idx--) {
					if (!initial) {
						System.out.print(" ");
					} else {
						initial = false;
					}
					System.out.print(ballIdx[idx]);
				}
				System.out.println();
			}
		} else {
			System.out.println(-1);
		}

	}

}


Measured memory_bytes: 52288
#include<iostream>
#include<array>

int main(){
  int N,M,C;
  int ans=0;
  std::array<int,20> B;
  std::array<std::array<int,20>,20> A;
  
  std::cin >> N >> M >> C;
  for(int i=0;i<M;i++){
    std::cin>>B[i];
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
    	std::cin>>A[i][j];
  	}
  }
  int cache=C;
  for(int i=0;i<N;i++){
    cache=C;
    for(int j=0;j<M;j++){
      cache += B[j]*A[i][j];
  	}
    if(cache>0)
      ans++;
  }
  std::cout<<ans<<std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
 
int main() {
    ll n, k, i, A[100000];
    cin>>n>>k;
    for(i=0; i<n; i++)
    cin>>A[i];
    sort(A, A+n);
    ll s=0;
    for(i=0; i<k; i++)
    s+=A[i];
    cout<<s;
    return 0;
}

Measured memory_bytes: 3656
class SumBinaryIndexedTree(val size: Int, val modulo: Long) {
    private val array: LongArray = LongArray(size){0L}
    fun increase(position: Int, value: Long): Unit {
        if (position < size) {
            array[position] = (array[position] + value) % modulo
            increase(position + ((position + 1) and position.inv()), value)
        }
    }
    operator fun get(position: Int): Long {
        return if (position < 0) 0L else (array[position] + get(position - ((position + 1) and position.inv()))) % modulo
    }

}
fun main(args: Array<String>?): Unit {
    while(true) {
        val (a, b, p) = readLine()!!.trim().split(' ').map(String::toInt)
        if (a == 0) return
        val numbers = (a .. b).map(Any::toString)
        val lexical = numbers.indices.sortedBy { numbers[it] }
        val bit = SumBinaryIndexedTree(numbers.size, p.toLong())
        var result = 0L
        for (i in lexical) {
            val prev = bit[i] + 1L
            result = (result + prev) % p
            bit.increase(i, prev)
        }
        println(result)
    }
}


Measured memory_bytes: 106364
#include <stdio.h>
int main(void)
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if ((a == b) && (b == c)) {
        printf("1\n");
    } else if ((a != b) && (b != c) && (c != a)) {
        printf("3\n");
    } else {
        printf("2\n");
    }
    return 0;
}


Measured memory_bytes: 128
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func solve(x int64) int64 {
	ret := int64(1)
	l := int64(0)
	for ; ; ret ++ {
		l += ret
		if l >= x {
			break
		}
	}

	return ret
}

func main() {
	defer out.Flush()

	x := nextInt()
	res := solve(x)
	fmt.Fprintln(out, res)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 1776
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
void insertionSort(int a[],int n)
{
    for(int i = 0;i < n;i++)
    {
        cout << a[i];
        if(i != n - 1)
        {
            cout << " ";
        }
    }
    cout << "\n";
    for(int i = 1;i < n;i++)
    {
        int v = a[i];
        int j = i - 1;
        while(j >= 0 && a[j] > v)
        {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        for(int k = 0;k < n;k++)
        {
            cout << a[k];
            if(k != n - 1)
            {
                cout << " ";
            }
        }
        cout << "\n";
    }
}
int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
    }
    insertionSort(a,n);

    return 0;
}


Measured memory_bytes: 3084
import java.util.Scanner;
    
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        
        int cnt = 0;
        for(int i = 0; i < n; i++){
            int x = Integer.parseInt(scanner.nextLine());
            if(isPrime(x)){
                cnt++;
            }
        }
        
        System.out.println(cnt);
    }
    
    public static boolean isPrime(int x) {
        if(x == 2){
            return true;
        }
        if(x < 2 || x % 2 == 0){
            return false;
        }

        int i = 3;
        while( i <= Math.sqrt(x) ){
            if(x % i == 0){
                return false;
            }
            i = i + 2;
        }
        return true;
    }
}



Measured memory_bytes: 59252
#include<iostream>
#include<cstdio>
using namespace std;
bool mp[2010][2010];char c[2010];
int s[2010][2010],h[2010][2010],l[2010][2010];
int main()
{
	int n,m,q;scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",c);
		for(int j=1;j<=m;j++)mp[i][j]=c[j-1]-'0';
	}
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)
	{
		h[i][j]=h[i-1][j]+h[i][j-1]-h[i-1][j-1]+(mp[i][j]&&mp[i-1][j]);
		l[i][j]=l[i-1][j]+l[i][j-1]-l[i-1][j-1]+(mp[i][j]&&mp[i][j-1]);
		s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+mp[i][j];
	}
	for(int i=1;i<=q;i++)
	{
		int X1,X2,Y1,Y2;scanf("%d%d%d%d",&X1,&Y1,&X2,&Y2);
		int H=h[X2][Y2]-h[X1][Y2]-h[X2][Y1-1]+h[X1][Y1-1];
		int L=l[X2][Y2]-l[X1-1][Y2]-l[X2][Y1]+l[X1-1][Y1];
		int S=s[X2][Y2]-s[X1-1][Y2]-s[X2][Y1-1]+s[X1-1][Y1-1];
		printf("%d\n",S-(H+L));
	}
	return 0;
}

Measured memory_bytes: 53120
#include <bits/stdc++.h>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pl= pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

int main(){
    bool flg=false;
    int n;cin >>n;
    int now=0;
    for (int i = 0; i < n; ++i) {
        int a,b;cin >>a>>b;
        if(a==b)now++;
        else {
            now=0;
        }
        if(now>=3)flg=true;
    }
    if(flg)puts("Yes");
    else puts("No");
}


Measured memory_bytes: 3632
#include<iostream>
#include<queue>
#include<string>
using namespace std;
int main(){
	int n,q,timetemp,now=0;
	string nametemp;
	queue<string> name;
	queue<int> time;
	cin >> n >> q;
	for (int i=0;i<n;i++){
		cin >> nametemp >> timetemp;
		name.push(nametemp);
		time.push(timetemp);
	}
	do{
		if( time.front()<=q ){
			now+=time.front();
			cout<< name.front() << " " << now << endl;
			time.pop(); name.pop();
		}else{
			time.push(time.front()-q);
			name.push(name.front());
			time.pop(); name.pop();
			now+=q;
		}
	} while((!name.empty())&&(!time.empty()));
	return 0;
}

Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
string n;
char b[4]={'Y','A','K','I'};
int main(){
    cin>>n;
    if(n[0]==b[0] && n[1]==b[1] && n[2]==b[2] && n[3]==b[3])
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

bool test = true;
int tt = 1;
#define ll long long
#define all(x) x.begin(), x.end()
#define sz(s) (int)(s.size())

struct fio
{
    fio()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout << fixed << setprecision(10);
    }
} fio;

const int N = 1e6 + 1;
int cnt[N];

bool check(int i) {
	int j = i;
	int res = 0;
	while(j < N) {
		res+=cnt[j];
		j+=i;
	}
	return (res <= 1);
}

int _gcd(int a, int b) {
	if(a == 0) return b;
	return _gcd(b%a, a);
}
int main() 
{
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++) {
    	cin >> v[i];
    }

    int g = accumulate(all(v), 0, _gcd);
    cerr << "gcd: " << g << "\n";
    if(g!=1) {
    	cout << "not coprime\n";
    	return 0;
    }
    for(int i=0; i<n; i++) cnt[v[i]]++;
    for(int i=2; i<N; i++) {
    	if(!check(i)) {
    		cout << "setwise coprime\n";
    		return 0;
    	}
    }
    cout << "pairwise coprime\n";
}

Measured memory_bytes: 11052
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;

int main(){
	int N;
	
	cin >> N;
	
	int waribiki = N/15;
	
	int ans = N*800-waribiki*200;
	
	cout << ans << endl;	

	return 0;
}


Measured memory_bytes: 256
//#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <cassert>
#include <fstream>
#include <algorithm>
#include <list>
#include <random>
#include <ctime>
#include <cmath>
#include <random>
#include <bitset>
#include <complex>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define mmin(a, b) a = min(a, (b))
#define mmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define ALL(a) a.begin(),a.end()
#define sqr(x) (x) * (x)
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int & 
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;

const double PI = 2 * acos(0.0);

template<class T>
void show(const vector<T> &a) {
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

const int N = 709;
int n, m;

int mat[N][N];
vi g[N];

const int L = N + N;
const int MID = N;

bool dp[2][L];
int used[N];

void dfs(int v, vi &ab) {
	++ab[used[v] - 1];
	for (int to : g[v]) {
		if (used[to] == 0) {
			if (used[v] == 1) used[to] = 2;
			else used[to] = 1;
			dfs(to, ab);
		}
		else if (used[to] == used[v]) {
			cout << "-1";
			exit(0);
		}
	}
}

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

	cin >> n >> m;

	fori(i, N) fori(j, N) mat[i][j] = (i != j);
	fori(iter, m) {
		int u, v;
		cin >> u >> v;
		mat[u][v] = mat[v][u] = 0;
	}

	for (int v = 1; v <= n; ++v) 
		for (int u = 1; u <= n; ++u) if (mat[v][u])
			g[v].pb(u);
	
	int p = 0, c = 1;
	dp[p][MID] = 1;
	for (int v = 1; v <= n; ++v) if (!used[v]){
		vi ab = { 0 , 0 };
		used[v] = 1;
		dfs(v, ab);
		int a = ab[0];
		int b = ab[1];
		int dif = a - b;
		for (int i = 0; i < L; ++i) if (dp[p][i]) {
			if (i - dif >= 0) dp[c][i - dif] = 1;
			if (i + dif < L) dp[c][i + dif] = 1;
		}
		fill(dp[p], dp[p] + L, 0);
		swap(p, c);
	}
	ll ans = 1LL * n * (n - 1) / 2;
	for (ll i = 0; i < L; ++i) if (dp[p][i]){
		ll rl = abs(i - MID);
		ll a = (n + rl) / 2;
		ll b = n - a;
		mmin(ans, a * (a - 1) / 2 + b * (b - 1) / 2);
	}
	cout << ans << endl;
}

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


int main() {
	int A, B, K;
	cin >> A >> B >> K;
	vector<int> vec;
	int N = min(A, B);
	for (int i = 1; i <= N; i++)
	{
		if (A%i==0 && B%i==0)
		{
			vec.push_back(i);
			
		}
	}
	reverse(vec.begin(), vec.end());
	cout << vec.at(K - 1) << endl;
}

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

int const N = 100000, md = 1e9 + 7;
int I[N + 1], inv[N + 1];

inline void ad(int &x, int y) { if ((x += y) >= md)x -= md; }

int main(){
	int n;
	scanf("%d", &n);
	inv[1] = 1;
	f(i, 2, n + 1)inv[i] = md - md / i * (ll)inv[md % i] % md;
	int fc = 1;
	f(i, 2, n + 1)fc = (ll)fc * i % md;
	f(i, 1, n){
		I[i] = inv[i + 1] % md;
		ad(I[i], I[i - 1]);
	}
	int an = 0;
	f(i, 1, n + 1){
		int t;
		scanf("%d", &t);
		ad(an, (ll)I[n - i] * t % md);
		ad(an, (ll)I[i - 1] * t % md);
		ad(an, t);
	}
	an = (ll)an * fc % md;
	printf("%d\n", an);
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <limits>
#include <utility>
#include <string>

int sub_solve(std::string s, int len, int num, int pos)
{
    int ans = 0;

    while(pos < s.length()) {
        if (s[pos] == '0' + num) {
            if (len == 1) {
                ans = 1;
            } else {
                for (int i = 0; i < 10; i++) {
                    ans += sub_solve(s, len - 1, i, pos + 1);
                }
            }
            break;
        }
        pos++;
    }

    return ans;
}

int solve(std::string s)
{
    int ans = 0;

    for (int i = 0; i < 10; i++) {
        ans += sub_solve(s, 3, i, 0);
    }

    return ans;
}

int main(int argc, char *argv[])
{
    int n;
    int ans;
    std::string s;

    std::cin >> n;
    std::cin >> s;

    ans = solve(s);

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    int A,B,C,K;
    
    cin >> A >> B >> C >>K;
    for(int a=1;a<=K;a++){
    if(A>=B&&A>=C){ A=A*2;}
    else if(B>=A&&B>=C){ B=B*2;}
    else { C=C*2;}
    }
    cout << A+B+C << endl;
    
    
    
    
    
        
    return 0;}

Measured memory_bytes: 256
k = gets.to_i
dist = Array.new(k,50)
que = [1]
dist[1] = 1
while que.any?
  f = que.shift
  if dist[(f*10)%k] > dist[f]
    dist[(f*10)%k] = dist[f]
    que.unshift((f*10)%k)
  end
  if dist[(f+1)%k] > dist[f]
    dist[(f+1)%k] = dist[f]+1
    que.push((f+1)%k)
  end
end

puts dist[0]

Measured memory_bytes: 3144
#include <stdio.h>

int main(void){

	/*4???13??????????¬??????????trump?????£?¨?
	 0??????S 1??????H 2??????C 3??????D */
	int trump[4][13] ;		//?????????????????????????????°???0???
	int j = 0 ;
	int i = 0 ;					//for???????????????????????°
	int n = 0 ;					//?????????????????°???????´????????????°
	char suite = '0' ;			//????????????????????????????´????????????°
	int row = 0 ;				//?????????????¨?????????????????????????
	int rank = 0 ;				//????????????????????????????´????????????°

	/*trump????????????*/
	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			trump[i][j] = 0 ;
		}
	}


	/*???????????????????????????????????±?????????*/
	scanf("%d", &n);
	(void)getchar();

	/*?????????????????±?????????n?????°?????????*/
	for(i = 1 ; i <= n ; i++){
		scanf("%c",&suite);
		(void)getchar();
		scanf("%d",&rank);
		(void)getchar();

		/*??????????????±?????????????????????*/
			switch(suite){
				case 'S':			//???????????????0???
					row = 0;
					break;

				case 'H':			//????????????1???
					row = 1 ;
					break;

				case 'C':			//????????????2???
					row = 2 ;
					break;

				case 'D':			//????????????3???
					row = 3 ;
					break;
			}

		/*???????????£????????????????????????????????°????????????*/
		trump[row][rank-1] = 1 ;

	}

	/*????????°????????£?????????????????????????????¨??????????????§????????????*/

	/*????????????*/
	for( i = 0 ; i < 13 ; i++){
		if(trump[0][i] == 0){
			printf("S %d\n" ,i+1);
		}
	}

	/*?????????*/
	for( i = 0 ; i < 13 ; i++){
		if(trump[1][i] == 0){
			printf("H %d\n" ,i+1);
		}
	}

	/*?????????*/
	for( i = 0 ; i < 13 ; i++){
		if(trump[2][i] == 0){
			printf("C %d\n" ,i+1);
		}
	}

	/*?????????*/
	for( i = 0 ; i < 13 ; i++){
		if(trump[3][i] == 0){
			printf("D %d\n" ,i+1);
		}
	}


	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <stdio.h>
#include <string>
#include<algorithm>
using namespace std;
 
const long long MAX=1000000001;
//bool say[1000000001]={};

int main(){
    int N;
    cin >> N;
    long long n[N];
    //long long n;
    long long i;
    long long c=0;
    for(i=0;i<N;i++){
        scanf("%lld",&n[i]);
        
    }
    sort(n,n+N);
    long long temp=n[0];
    c++;
    for(i=1;i<N;i++){
        if(n[i]==temp){
            c--;
            temp=0;
        }else{
            c++;
            temp=n[i];
        }
    }
    
    cout << c <<endl;
    
    return 0;
}

Measured memory_bytes: 1024
import collections
N = int(input())
S = [input() for i in range(N)]
cnt = collections.Counter(S)
oldVal = cnt.most_common()[0][1]

ans = []
for i in cnt.most_common():
    if oldVal == i[1]:
        ans.append(i[0])
        oldVal = i[1]
    else:
        break
ans.sort()
print('\n'.join(ans))



Measured memory_bytes: 45040
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int m, n;
vector<vector<pair<bool, int> > > mp(1001, vector<pair<bool, int> >(1001, pair<bool, int>(false, 0)));
vector<vector<P> > memo(1001, vector<P>(1001, P(-1, -1)));
P dfs(P np) {
	if(memo[np.first][np.second].first != -1) {
		return memo[np.first][np.second];
	}
	if(np.first < 0 || np.first >= 1001 || np.second < 0 || np.second >= 1001 || mp[np.first][np.second].second > m) {
		return P(0, 0);
	}
	P res;
	res = max(max(dfs(P(np.first + 1, np.second)), dfs(P(np.first + 1, np.second - 1))), dfs(P(np.first + 1, np.second + 1)));
	if(mp[np.first][np.second].first) {
		return memo[np.first][np.second] = max(P(1, mp[np.first][np.second].second), P(res.first + 1, res.second));
	} else {
		return memo[np.first][np.second] = max(P(0, 0), P(res.first, res.second));
	}
}

int main(void) {
	vector<bool> prime(1001 * 1001 + 1, true);
	prime[0] = prime[1] = false;
	FOR(i, 2, 1001 * 1001 + 1) {
		if(prime[i]) {
			for(ll j = 2; i * j <= 1001 * 1001; ++j) {
				prime[i * j] = false;
			}
		}
	}
	P cp = P(500, 500);
	ll cnt = 1;
	ll size = 1;
	ll lim = 1;
	while(cnt <= 1001 * 1001) {
		mp[cp.first][cp.second].second = cnt;
		if(prime[cnt]) mp[cp.first][cp.second].first = true;
		--lim;
		if(lim == 0) {
			size += 2;
			++cp.second;
			lim = size * size - (size - 2) * (size - 2);
		} else {
			if(lim >= 2 * (size - 1) + size) {
				--cp.first;
			} else if(lim >= (size - 1) + size) {
				--cp.second;
			} else if(lim >= size) {
				++cp.first;
			} else {
				++cp.second;
			}
		}
		++cnt;
	}
	while(true) {
		cin>>m>>n;
		if(m == 0 && n == 0) break;
		P sp;
		bool upd = false;
		REP(i, 1001) {
			REP(j, 1001) {
				if(mp[i][j].second == n) {
					sp.first = i;
					sp.second = j;
					upd = true;
					break;
				}
			}
			if(upd) break;
		}
		REP(i, 1001) {
			REP(j, 1001) {
				memo[i][j].first = memo[i][j].second = -1;
			}
		}
		P ans = dfs(sp);
		if(ans.first == 0) cout<<0<<" "<<0<<endl;
		else cout<<ans.first<<" "<<ans.second<<endl;
	}
}

Measured memory_bytes: 26752
#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

//template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
//constexpr int INF=inf<int>;
//constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  int N;
  ll K;
  cin >> N >> K;
  vll A(N);
  for (auto& a : A) {
    cin >> a;
  }

  // cumulative sum
  vll S(N+1);
  for (int i=1; i<=N; i++) {
    S[i] = (A[i-1] + S[i-1])%K;
  }
  //dumpContents(S, "S");

  // cumulative sum - i
  map<ll, int> counter;
  counter[0]++;
  ll ret = 0;

  for (int i=1; i<=N; i++) {
    S[i] = (K+S[i]-(i%K))%K;
    // expired
    if (i>=K) {
      counter[S[i-K]]--;
    }
    ret += counter[S[i]];
    counter[S[i]]++;
  }

  //dumpContents(S, "Si-i");
  //dumpContents(counter, "counter");

  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 15872
#include <iostream>
#include <list>
#include <string>
#include <sstream>
#include <stdlib.h>
#include <cmath>

using namespace std;

void drip1(int x, int y,int square[10][10]){
    int i;
    for(i=x-1;i<=x+1;i++){
        if(i>=0 && i<10)square[i][y] += 1;
    }
    for(i=y-1;i<=y+1;i+=2){
        if(i>=0 && i<10)square[x][i] += 1;
    }
    
}

void drip2(int x, int y,int square[10][10]){
    for(int i=x-1;i<=x+1;i++){
        for(int j=y-1;j<=y+1;j++){
            if(i>=0 && j>=0 && i<10 && j<10){
                square[i][j] += 1;
            }
        }
    }

}

void drip3(int x, int y,int square[10][10]){
    
    for(int i=x-2;i<=x+2;i++){
        for(int j=y-2+abs(x-i); j<=y+2-abs(x-i); j++){
            if(i>=0 && j>=0 && i<10 && j<10){
                square[i][j] += 1;
            }
        }
    }
}



int main (int argc, char const* argv[]){
    int square[10][10]={};
    int size,x,y, count=0, max=0;
    string str, tmp;
    list<int> xysize;
    
    while(getline(cin,str)){
        stringstream ss(str);
        xysize.clear();
        
        while(getline(ss,tmp,',')){
            xysize.push_back(atoi(tmp.c_str()));
        }
        list<int>::iterator it = xysize.begin();
        x = *(it++);
        y = *(it++);
        size = *(it);
        
        
        if(size==1){
            drip1(x,y,square);
        }else if(size==2){
            drip2(x,y,square);
        }else if(size==3){
            drip3(x,y,square);
        }
    }
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            if(square[i][j]==0)count++;
            if(max < square[i][j]) max = square[i][j];
        }
    }

    
    cout << count << endl << max << endl;
    
    return 0;
}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int N = 200009;
int n, a[N];
int suf[N], ans = 1000000000000000000;

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

    for(int i = n-1; i >= 0; --i) {
        suf[i] = suf[i+1] + a[i];
    }

    int pre = 0;
    for(int i = 0; i < n; ++i) {
        pre += a[i];
        int cand = abs(suf[i+1] - pre);
        ans = min(ans, cand);
    }

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3328
// https://atcoder.jp/contests/abc157/tasks/abc157_c

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

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#if DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

const int N_MAX = 3;
const int M_MAX = 5;
const int C_I_MAX = 9;

int N, M;
vector<int> s;
vector<int> c;

vector<int> m;

int main() {
  cin >> N >> M;
  s = vector<int>(M);
  c = vector<int>(M);
  REP(i, M) cin >> s[i] >> c[i];

  m = vector<int>(4);
  m[0] = 1; REP(i, 3) m[i + 1] = m[i] * 10;

  int f = N == 1 ? 0 : m[N - 1];
  int t = m[N] - 1;

  FOR(i, f, t) {
    bool match = true;
    REP(j, M) {
      match &= (i % m[N + 1 - s[j]] / m[N - s[j]] == c[j]);
    }
    if (match) {
      cout << i << endl;
      return 0;
    }
  }

  cout << -1 << endl;
}


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

#define NL '\n'
#define C char
#define D double
#define F float
#define S string

#define sz(x) x.size()
#define INF LONG_MAX
#define IINF LLONG_MAX
#define PI (2.0*acos(0.0))

#define sfi(x) scanf("%d",&x)
#define sfi2(x,y) scanf("%d %d",&x,&y)
#define sfi3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define sfl(x) scanf("%lld",&x)
#define sfl2(x,y) scanf("%lld %lld",&x,&y)
#define sfl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define sfd(x) scanf("%lf",&x);

#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max(max3(a,b,c),d)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min(a,min3(b,c,d))

#define pb push_back
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(),x.end()
#define asort(x) sort(all(x));
#define dsort(x) sort(all(x), greater<int>())
#define unq(x) x.erase(unique(x.begin(),x.end()),x.end())

#define mem(ara,val) memset(ara,val,sizeof(ara))
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)
#define IOS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

LL gcd(LL a,LL b)
{
    if(b==0) return a;
    else return gcd(b,a%b);
}
LL lcm(LL a,LL b)
{
    return a/gcd(a,b)*b;
}

LL bigmod(LL base, LL power, LL mod)
{
    if(power==0) return 1;
    else if(power%2==1)
    {
        LL value1 = base % mod; LL value2 = (bigmod(base,power-1,mod))%mod;
        return (value1*value2)%mod;
    }
    else
    {
        LL value1 = (bigmod(base,power/2,mod))%mod;
        return (value1*value1)%mod;
    }
}



int main()
{
    //IOS;

    int s,w;
    sfi2(s,w);

    if(s<=w) cout<<"unsafe";
    else cout<<"safe";

}


Measured memory_bytes: 3760
// AOJ 1590: One-Time Path
// 2017.11.29 bal4u@uu

#include <stdio.h>
#include <string.h>

#define MAX 200000
typedef struct { int t, node; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
//	if (qsize == 0) return 0;
//	*n = que[0].node, *t = que[0].t, *c = que[0].c;
	que[0] = que[--qsize];
	min_heapify(0);
//	return 1;
}

void enq(int n, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].node = n, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

#define INF 1000000010
typedef struct { int to[30]; int c[30]; } TBL;
TBL tbl[100002];
int len[100002];
int dist[100002];
int lastn[200002], lastc[200002]; sz;

void dijkstra(int start)
{
	int i, s, e, c, d;

	qsize = 0;
	dist[start] = 0;
	enq(start, 0);
	while (qsize) {
		s = que[0].node; c = que[0].t, deq();
		for (i = 0; i < len[s]; i++) {
			e = tbl[s].to[i];
			if (c <= (d = tbl[s].c[i]) && d < dist[e]) dist[e] = d, enq(e, d);
		}
	}
}

char buf[40], *bp;
int getint()
{
	int n = 0;
	while (*bp >= '0') n = (n<<3) + (n<<1) + (*bp++ & 0xf);
	return n;
}

int main()
{
	int n, n1, m, a, b, c, i, ans;

	fgets(bp=buf, 40, stdin);
	n = getint(), bp++, m = getint();
	n1 = n - 1;

	for (i = 0; i < m; i++) {
		fgets(bp=buf, 40, stdin);
		a = getint()-1, bp++, b = getint()-1, bp++, c = getint();
		tbl[a].to[len[a]] = b, tbl[a].c[len[a]++] = c;
		if (b == n1) lastn[sz] = a, lastc[sz++] = c;
	}

	memset(dist, 0x77, sizeof(dist));
	dijkstra(0);

	ans = 0;
	if (dist[n-1] > INF) puts("-1");
	else {
		for (i = 0; i < sz; i++) {
			a = lastn[i], c = lastc[i];
			if (dist[a] <= c && c > ans) ans = c;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 26072
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[]
for _ in range(n):
    ai=list(map(int,input().split()))
    a.append(ai)
ans = 0
for i in range(n):
    t=c
    for j in range(m):
        t+=a[i][j]*b[j]
    ans += 1 if t > 0 else 0
print(ans)


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

int main(){
int a,b,i;
int ans[7];
for(i = 0;i < 7;i++){
cin >> a >> b;
ans[i] = a-b;
}
for(i = 0;i < 7;i++){
cout << ans[i] << endl;
}
return 0;
}

Measured memory_bytes: 1160
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: June 29, 2019
 * 
 */

#include <bits/stdc++.h>

//#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define endl '\n'
using namespace std;

const int  mxx = 1e6 + 5;

auto SOLUTION_FUNCTION( void ) ->void {

    // your solution goes here 

    int n; 

    cin>>n;

    vi h(n);
    iv(h);
    vi dp(n , INT_MAX);
    dp[0] = 0;

    rep(n){
        for(int j: {i+1,i+2})
            dp[j] = min(dp[j] , dp[i]+abs(h[i] - h[j]));
    }
    cout<<dp[n-1]<<endl;

    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("ain","r",stdin);
    freopen("aout","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
const int INF = 1e9;

int main() {
  ll n, total = 0;
  string s;
  cin >> n >> s;
  ll r = 0, g = 0, b = 0;
  rep(i, n) {
    if (s[i] == 'R') r++;
    if (s[i] == 'G') g++;
    if (s[i] == 'B') b++;
  }
  total = r * g * b;
  int k;
  for (int i = 0; i < n - 2; ++i) {
    for (int j = i + 1; j < n - 1; ++j) {
      k = j + j - i;
      if (k < n) {
        if ((s[i] != s[j]) && (s[i] != s[k]) && (s[j] != s[k])) total--;
      }
    }
  }
  cout << total << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
 #include <ext/pb_ds/tree_policy.hpp>
 #include <ext/pb_ds/assoc_container.hpp>
 #include<chrono>
 using namespace std;
 using namespace std::chrono;      
 using namespace __gnu_pbds; 
 #define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 #define fi         first
 #define se         second
 #define int         long long 
 #define pb         push_back
 #define emp        emplace_back
 #define vv(x)      vector<x>
 #define mp(x,y)    map<x,y>
 #define dq(x)      deque<x>
 #define pql(x)     priority_queue<x>
 #define pqs(x)     priority_queue<x,vv(x),greater<x> >
 #define M          1000000007
 #define forf(i,a,b) for(int i=a;i<b;i++)
 #define it(x)      x::iterator
 #define ll         long long 
 #define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
 #define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
 #define vii        vector<int>
 #define big        3e18
 #define sm         -2e9
 #define mkr        make_pair
 #define vpi        vector<pair<int,int> >
 #define pii        pair<int,int>
 #define rng        500005
 #define sz(x)      (int)x.size()
 #define rv(x)      reverse(x.begin(),x.end())
 #define out(x)     cout<<x.fi<<" "<<x.se<<endl;

//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
  
void pr_init()
{
   
    #ifndef ONLINE_JUDGE
    freopen("gin.txt", "r", stdin);
    freopen("gout.txt", "w", stdout);
   
    #endif
}
 

void solve()
{
  int n;
  cin >> n;

  int fl = 0;
  

  for(int i=1;i<=9;i++)
  {
    for(int j=1;j<=9;j++)
    {
      if(n==i*j)fl=1; 
    }
  }

  cout<<(fl?"Yes":"No");
    
}


int32_t main()
{
  pr_init();
  fastio;
  
  auto start = high_resolution_clock::now(); 
 
  solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
   // cout << "Time taken by function: "
   //       << duration.count() << " microseconds" << endl; 

 }
      
      

Measured memory_bytes: 3556
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		long a = sc.nextLong(), b = sc.nextLong();
		long c = sc.nextLong(), d = sc.nextLong();
		long ans = 0;
		ans = Math.max(a*c, b*d);
		ans = Math.max(ans, b*c);
		ans = Math.max(ans, a*d);
		System.out.println(ans);
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

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

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}


Measured memory_bytes: 32656
#include <bits/stdc++.h>
#define ll long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define foin for (int i = 0; i < n; i++)
#define fojn for (int j = 0; j < n; j++)
#define vi vector<int>
#define vil vector<ll>
#define omii map<int,int>
#define omlii map<ll,ll>
#define umii unordered_map<int,int>
#define umlii unordered_map<ll,ll>
#define pi pair<int,int>
#define pli pair<ll,ll>

using namespace std;



void solve() {
	ll a, b;
	cin >> a >> b;
	cout << a*b << "\n";
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio;
	int t;


	solve();


}

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

#define P complex<double>

int main(){
  int n, ans;
  P a,b, z;
  double ra, rb, d;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> a.real() >> a.imag() >> ra;
    cin >> b.real() >> b.imag() >> rb;
    /*
    cout << "a=" << a << " ra=" << ra << endl;
    cout << "b=" << b << " rb=" << rb << endl;
    */
    z = a-b;
    d=abs(z);
    //    cout << "d=" << d << endl;

    if( ra+rb < d ) // dÈÁÄ¢È¢
      ans = 0;
    else  if( ra > d + rb ){ // a ÌÉ b
      ans = 2;
    }else if( rb > d + ra ){ // b ÌÉ a
      ans = -2;
    }else 
      ans = 1; 

    cout << ans << endl;
  }
  return 0;
} 

Measured memory_bytes: 0
//#include <iostream>
//#include <algorithm>
#include <bits/stdc++.h>

using namespace std;
int main()
{
	int n,t,a,h[1010],ans;
	double minh=1e9;
	cin >> n >> t >> a;
	for(int i=1; i<=n; i++){
		cin >> h[i];
		double tmp = abs(a - (t - h[i] * 0.006));
		if(minh > tmp){
			ans = i;
			minh = tmp;
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, i, j, k, l; cin >> N; char m;
if(N==1){ cout << "a\n"; return 0; }
vector< vector<string> > V(N); N--;
vector<string> w={"a","b","c","d","e","f","g","h","i","j","k"};
V[0]={"a"}; V[1]={"aa","ab"};
for(i=2; i<=N; i++){
for(j=0; j<V[i-1].size(); j++){
  for(m='a', k=0; k<i; k++){ m=max(m, V[i-1][j][k]); }
  for(l=m-'a'+2, k=0; k<l; k++){ V[i].push_back(V[i-1][j]+w[k]); }
}
}
for(i=0; i<V[N].size(); i++){ cout << V[N][i] << "\n"; }
}

Measured memory_bytes: 11380
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] a = new int[N+1];
   int[] b = new int[N];  
   for(int i = 0; i<N+1 ; i++){
   a[i] = sc.nextInt();
   }
   for(int i = 0; i<N ; i++){
   b[i] = sc.nextInt();
   }
   int tmpa1 = 0;
   int tmpa2 = 0;
   int tmpb1 = 0;
   long total = 0;
 for(int i=0;i<N;i++){
   if(i==0){
   tmpa1 = a[i];
   tmpa2 = a[i+1];
   tmpb1 = b[i];
   }else{
   tmpa1 = tmpa2;
   tmpa2 = a[i+1];
   tmpb1 = b[i];
   }
   if(tmpa1 >=tmpb1){
    total+=tmpb1; 
   }else{
     tmpb1 = tmpb1 - tmpa1 ;
     total+=tmpa1 ;
     if(tmpb1>=tmpa2){
      total+=tmpa2;
       tmpa2=0;
     }else{
      total +=tmpb1;
      tmpa2 -=tmpb1;
   }
   }
  }
   System.out.println(total);
 }
}

Measured memory_bytes: 65212
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
  cin>>n>>m;
  int a[m];
  int sum=0;
  for(int i=0;i<m;++i)
  {cin>>a[i];
  	sum+=a[i];
  }
  int res=n-sum;
  if(res<0)
    cout<<-1;
  else
    cout<<res;

}

Measured memory_bytes: 3672
#include <utility>
#include <cstdio>
#include <set>
int arr[200005];
int main()
{
	// freopen("AGC029-C.in", "r", stdin);
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", arr + i);
	int l = 1, r = n, ans = -1;
	while (l <= r)
	{
		int m = l + r >> 1;
		std::multiset<std::pair<int, int> > se;
		bool flg = true;
		for (int i = 0; i < n; i++)
		{
			if (se.empty() || (--se.end())->first < arr[i])
			{
				se.insert({arr[i], 0});
				continue;
			}
			while (se.size() >= 2 && (----se.end())->first >= arr[i])
				se.erase(--se.end());
			{
				int val = (--se.end())->second;
				se.erase(--se.end());
				se.insert({arr[i], val});
			}
			auto it = --se.end();
			while (it != se.begin() && it->second == m - 1)
			{
				auto orig = it;
				it--;
				se.insert({orig->first, 0});
				se.erase(orig);
			}
			if (it->second == m - 1)
			{
				flg = false;
				break;
			}
			se.insert({it->first, it->second + 1});
			auto pre = it;
			if ((it != se.begin() && (--pre)->first + 1 == it->first) || (it->first == 1))
			{
				se.erase(it);
				continue;
			}
			{
				se.insert({it->first - 1, it->second});
				se.erase(it);
			}
		}
		if (flg)
		{
			ans = m;
			r = m - 1;
		}
		else
			l = m + 1;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 10368
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <numeric>
#include <set>
#include <queue>
using namespace std;

int main(int argc, char const *argv[])
{
  int N, M;
  cin >> N >> M;
  vector<bool> isRoot(N, true);
  vector<vector<int>> edges(N);
  vector<set<int>> rev(N);
  for (int i = 0, l = N + M - 1; i < l; ++i)
  {
    int fr, to;
    cin >> fr >> to;
    fr--;
    to--;
    isRoot[to] = false;
    edges[fr].push_back(to);
    rev[to].insert(fr);
  }

  int root = distance(isRoot.begin(), find(isRoot.begin(), isRoot.end(), true));

  vector<int> answer(N, -1);
  answer[root] = 0;

  queue<int> que;
  que.push(root);
  while (!que.empty())
  {
    int fr = que.front();
    que.pop();

    for (const auto &to : edges[fr])
    {
      if (rev[to].size() == 1)
      {
        answer[to] = 1 + (*rev[to].begin());
        que.push(to);
      }
      rev[to].erase(fr);
    }
  }

  for (const auto &i : answer)
  {
    cout << i << '\n';
  }
  cout.flush();
}


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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    string s;
    cin >> s;
    int k;
    cin >> k;
    vector<string> vc;
    string sub;
    for (int i = 1; i < k+1; i++)
    {
        for (int j = 0; j+i-1<s.length(); j++)
        {
            sub = s.substr(j,i);
            vc.push_back(sub);
        }
    }
    sort(vc.begin(),vc.end());
    unique(vc.begin(),vc.end());
    
    cout << vc[k-1] << endl;
    
    
}

Measured memory_bytes: 1660