akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;	
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef map<int,int> mii;
typedef pair<int,int> pii;
#define INF 1000000000
#define MOD 1000000007
#define itr ::iterator it
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define remin(a,b) (a) = min((a),(b))
#define remax(a,b) (a) = max((a),(b))	
#define ll long long
#define db double
#define el "\n"
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int n,w,i,j;
	cin>>n>>w;
	int a[n+1],b[n+1];
	for(i=1;i<=n;i++){
		cin>>a[i]>>b[i];
	}
	ll int dp[n+1][w+1];
	memset(dp,0,sizeof(dp));
	for(i=1;i<=n;i++){
		for(j=1;j<=w;j++){
			if(a[i]<=j){
				dp[i][j]=max(dp[i-1][j],b[i]+dp[i-1][j-a[i]]);
			}
			else{
				dp[i][j]=dp[i-1][j];
			}
		}
	}
	cout<<dp[n][w];
}

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

int main(){
    string s;
    cin >> s;
    if (s == "Sunny"){
        cout << "Cloudy" <<endl;
    }
    if (s == "Cloudy"){
        cout << "Rainy" <<endl;
    }
    if (s == "Rainy"){
        cout << "Sunny" <<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#define NDEBUG

#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <utility>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <tuple>
#include <set>
#include <map>

// [0, max)
#define FOR0(var, max) for (sl (var) = 0; (var) < (max); ++(var))
// [min, max)
#define FORi(var, min, max) for (sl (var) = (min); (var) < (max); ++(var))
// [min, max)
#define FORi_INV(var, min, max) for (sl (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

// a < b < c
#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
// a <= b < c
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
// a < b <= c
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
// a <= b <= c
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

#ifndef NDEBUG
#  define MASSERT(cond) m_assert(cond, __LINE__, #cond);
#else
#  define MASSERT(...)
#endif

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

using ld = long double;

void m_assert(const bool& cond, const sl& line, const char *condstr) {
  if (!cond) {
    cerr << "Assertion Failed: " << condstr << " at line " << line << endl;
    exit(1);
  }
}

const static sl NMAX = 100000;
static sl N, K;
using Edge = pair<sl, sl>;
static vector<vector<sl>> Ei;
static vector<Edge> edges;
static map<Edge, sl> colors;
static bool visit[NMAX];
static sl prev_colors[NMAX];

void solve(void) {
  K = 1;
  visit[0] = true;
  prev_colors[0] = 0;

  deque<sl> que;
  que.push_back(0);
  while(!que.empty()) {
    sl idx = que.front();
    que.pop_front();
    sl cur = 0;
    FORITER(Ei[idx], it) {
      if (it == Ei[idx].end()) {
        break;
      } 
      if (visit[*it]) {
        continue;
      }
      cur++;
      if (cur == prev_colors[idx]) {
        cur++;
      }
      visit[*it] = true;
      K = max(K, cur);
      colors[make_pair(idx, *it)] = cur;
      colors[make_pair(*it, idx)] = cur;
      prev_colors[*it] = cur;
      que.emplace_back(*it);
    }
  }

  printf("%lld\n", K);
  FORITER(edges, it) {
    printf("%lld\n", colors[*it]);
  }
}

int main(void) {
  scanf("%lld", &N);
  sl a, b;
  Ei.resize(N);
  FOR0(i, N - 1) {
    scanf("%lld %lld", &a, &b);
    a -= 1;
    b -= 1;
    Ei[a].emplace_back(b);
    Ei[b].emplace_back(a);
    edges.emplace_back(a, b);
  }
  solve();
  return 0;
}

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

int main(){
  int N;
  string S;
  cin >> N >> S;
  
  int counter = 0;
  rep(i,N-2){
    if('A' == S.at(i) && 'B' == S.at(i+1) && 'C' == S.at(i+2)){
      counter++;
    }
  }
  
  cout << counter << endl;
}

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

int main(){
	int n;
	cin >> n;
	map<string, int> mp;
	int MAX = 0;
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		mp[s]++;
		MAX = max(MAX, mp[s]);
	}
	for(auto i : mp){
		if(i.second == MAX){
			cout << i.first << endl;
		}
	}
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(),(x).end()
inline cpp_int between(cpp_int n, cpp_int x) {
  if(n >= 0)
    return (n/x)+1;
  else
    return 0;
}

int main () {
  int h, w;
  string str;
  cin >> h >> w;
  REP(i, h) {
    cin >> str;
    cout << str << endl;
    cout << str << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import math

class Point():
    def __init__(self, x, y):
        self.x = x
        self.y = y

def Cp(p1, p2, p3):
    xa = p1.x-p2.x
    ya = p1.y-p2.y
    xb = p3.x-p2.x
    yb = p3.y-p2.y
    return xa*yb-ya*xb

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
for l in range(len(N)):

    x1,y1,x2,y2,x3,y3,x4,y4 = [float(i) for i in N[l].split(",")]

    p1 = Point(x1,y1)
    p2 = Point(x2,y2)
    p3 = Point(x3,y3)
    p4 = Point(x4,y4)

    cp1 = Cp(p1,p2,p3)
    cp2 = Cp(p2,p3,p4)
    cp3 = Cp(p3,p4,p1)
    cp4 = Cp(p4,p1,p2)

    if cp1 > 0 and cp2 > 0 and cp3 > 0 and cp4 > 0:
        print("YES")
    elif cp1 < 0 and cp2 < 0 and cp3 < 0 and cp4 < 0:
        print("YES")
    else:
        print("NO")



Measured memory_bytes: 5644
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;


#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 


ll ston(string s) 
{ 
    stringstream geek(s); 
    ll x = 0; 
    geek >> x; 
    
  
    return x; 
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[0] < v2[0]; 
} 

 ll degit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }

void solve()
{
	ll m,n;
	cin>>m>>n;
	vector<pair<ll,ll>> a(m),b(n);
	for(ll i=0;i<m;i++)
		cin>>a[i].ff>>a[i].ss;
	for(ll i=0;i<n;i++)
		cin>>b[i].ff>>b[i].ss;
	ll mn=1e9,ans;
	for(ll i=0;i<m;i++)
	{
		mn=1e9;
		
		ans=-1;
		for(ll j=0;j<n;j++)
		{
			// cout<<(abs(a[i].ff-b[j].ff)+abs(a[i].ss-b[j].ss))<<" ";
			if((abs(a[i].ff-b[j].ff)+abs(a[i].ss-b[j].ss))<mn)
				ans=j+1,mn=(abs(a[i].ff-b[j].ff)+abs(a[i].ss-b[j].ss));
		}
		cout<<ans<<endl;
	}
	return;
}

int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int h, w;
    while (true)
    {
        cin >> h >> w;
        if (h == 0)
            break;
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if ((i + j) % 2 == 0)
                {
                    cout << "#";
                }
                else
                {
                    cout << ".";
                }
            }
            cout << "\n";
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3080
package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    inputs := make([]int, 5)
    for i := 0; i < 5; i++ {
        scanner.Scan()
        x, _ := strconv.Atoi(scanner.Text())
        inputs[i] = x
    }
    a, b, c, x, y := inputs[0], inputs[1], inputs[2], inputs[3], inputs[4]
    ans := 0
    if a + b > 2 * c {
        if x > y {
            ans += 2 * c * y
            if a > 2 * c {
                ans += 2 * c * (x - y)
            } else {
                ans += a * (x - y)
            }
        } else {
            ans += 2 * c * x
            if b > 2 * c {
                ans += 2 * c * (y - x)
            } else {
                ans += b * (y - x)
            }
        }
    } else {
        ans = a * x + b * y
    }
    fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>

using namespace std;

int main()
{
    int n,d,a,x,h;
    cin >> n >> d >> a;
    
    pair<long long, long long> arr[n];
    for(int i=0; i<n; i++){
        cin >> x >> h;
        h = (h + a -1) / a;
        arr[i].first  = x;
        arr[i].second = h;
    }
    
    sort(arr, arr+n);
    long long pref[n+1]={0};
    
    int j=0;
    long long ans = 0;
    
    for(int i=0; i<n; i++){
        //decide the place where the influenced does not reach out
        while(j<n && arr[i].first + 2*d >= arr[j].first)
            j ++ ;
        
        long long necessary = max(0LL, arr[i].second - pref[i]);
        ans += necessary;
        pref[i] += necessary;
        pref[i+1] += pref[i]; //continue the preferences by far
        pref[j] -= necessary; //tujitumaawase       
    }
    
    
    
    
    cout << ans << endl;
    return 0;
}
/*
    int m,n,k,cand;
    cin >> m >> n >> k;

    int a[m+1] = {0};
    a[0] = n;

    for(int i=0;i<k;i++){
        cin >> cand;
        for(int j=0; j<m+1; j++){
            if(a[j]>0){
                a[j]--;
                a[cand]++;
            }
        }
    }
    
    int maxi=0;
    for(int i=1;i<m+1;i++){
        if(a[i]>maxi) 
            maxi = a[i];
    }

    for(int i=1;i<m+1;i++){
        if(a[i]==maxi) 
            cout << i << endl;
    }


    for(int i=1;i<m+1;i++){
        cout << a[i] << endl;
    }
*/
 



Measured memory_bytes: 4992
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
    ($line:expr,$name:ident,$t:tt) => {
        let $name=value!($line,$t);
    };
    }

    macro_rules! values_def {
    ($lines:expr,$n:expr,$name:ident,$t:tt) => {
        let $name={
        let mut vec=Vec::new();
        for i in 0..$n{
            let mut next=$lines.next().unwrap().split_whitespace();
            vec.push(value!(next,$t));
        }
        vec
        };
    };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

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

fn solve(input: String) -> String {
    input!(input=>(a:i64 b:i64));
    std::cmp::max(a + b, std::cmp::max(a - b, a * b)).to_string()
}

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

tests! {
    test1: "3 1" => "4",
    test2: "4 -2" => "6",
    test3: "0 0" => "0",
}


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


int main(){
    while(1){
        int h,w;
        cin>>h>>w;
        if(h==0 && w==0) break;
        else{
            for(int i=0;i<h;i++){
                if(i==0 || i==h-1){
                    for(int j=0;j<w;j++){
                        cout<<"#";
                    }
                    cout<<endl;
                    
                }else{
                    cout<<"#";
                    for(int j=0;j<w-2;j++){
                        cout<<".";
                    }
                    cout<<"#";
                    cout<<endl;
                }

            }
            cout<<endl;
        }
    }
}


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

int Gsize=0;
int *G;
int cnt=0;

int ReadValue() {
    int value;
    scanf("%d",&value);
    return value;
}
void ReadArray(int *Array,int index) {
    int i;
    for (i=0; i<index; i++) {
        scanf("%d",&Array[i]);
    }
}
void insertionSort(int Array[],int index,int g) {
    int i;
    for (i=g; i<index; i++) {
        int v=Array[i];
        int j=i-g;
        while (j>=0 && Array[j]>v) {
            Array[j+g]=Array[j];
            j-=g;
            cnt++;
        }
        Array[j+g]=v;
    }
}
void shellSort(int *Array,int index) {
    G=(int *)malloc(index*sizeof(int));
    for (int h=1; ; ) {
        if (h>index) {
            break;
        }
        G[Gsize]=h;
        Gsize++;
        h=3*h+1;
    }
    int i;
    for (i=Gsize-1; i>=0; i--) {
        insertionSort(Array,index,G[i]);
    }
}
int main() {
    int n=ReadValue();
    int A[n]; ReadArray(A,n);
    shellSort(A,n);
    printf("%d\n",Gsize);
    int i;
    for (i=Gsize-1; i>=0; i--) {
        printf("%d",G[i]);
        if (i) {
            printf(" ");
        }
    }
    printf("\n");
    printf("%d\n",cnt);
    for (i=0; i<n; i++) {
        printf("%d\n",A[i]);
    }
    return 0;
}


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

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

typedef long long ll;
typedef pair<int, int> P;

#define MAX 100005
#define INF INT_MAX

struct Edge {
    int to;
    int cost;
};

int main(int, char**)
{
    int n;
    cin >> n;

    vector< vector<Edge> > G(n);
    rep(i,n) {
        int u, k;
        cin >> u >> k;
        rep(j,k) {
            int v, c;
            cin >> v >> c;
            G[u].push_back({v, c});
        }
    }
    priority_queue<P> q;
    vector<int> d(n, INF);
    d[0] = 0;
    q.push({0, 0});
    while (!q.empty()) {
        int v, c;
        tie(c,v) = q.top(); q.pop();
        if (d[v] < c) continue;
        for (auto e : G[v]) {
            if (d[e.to] <= d[v] + e.cost) continue;
            d[e.to] = d[v] + e.cost;
            q.push({d[e.to], e.to});
        }
    }
    rep(i,n) cout << i << " " << d[i] << endl;

    return 0;
}



Measured memory_bytes: 3176
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define eps 0.00000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	long long k;
	cin >> k;
	cout << "50" << endl;
	vector<long long> hoge;
	REP(i, 50) {
		hoge.push_back(49);
	}
	for (int i = 0;i < hoge.size();++i) {
		hoge[i] += k / 50;
	}
	for (int i = 0;i < k % 50;++i) {
		for (int q = 0;q < hoge.size();++q) {
			hoge[q]--;
		}
		hoge[i] += 51;
	}
	REP(i, 50) {
		cout << hoge[i] << " ";
	}
	cout << endl;
	return 0;
}

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

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

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

bool chkmax(int &x,int y){return x<y?x=y,true:false;}
bool chkmin(int &x,int y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

ll n,k;
char s[105];

int main(){
	scanf("%s",s+1); n=strlen(s+1);
	k=readint();
	if(s[1]==s[n]){
		int lf=0,rg=0;
		for(int i=2;i<=n;i++){
			if(s[i]!=s[i-1]){
				lf=i-1;
				break;
			}
		}
		for(int i=n-1;i>=1;i--){
			if(s[i]!=s[i+1]){
				rg=i+1;
				break;
			}
		}
		if(!lf){
			printf("%lld\n",1ll*n*k/2);
			return 0;
		}
		ll cnt=0,ans=0;
		for(int i=lf+1;i<=rg-1;i++){
			if(s[i]!=s[i-1]){
				ans+=cnt/2;
				cnt=1;
			}
			else cnt++;
		}
		ans+=cnt/2;
		printf("%lld\n",(k-1)*((n-rg+1+lf)/2)+lf/2+(n-rg+1)/2+ans*k);
	}
	else{
		ll cnt=0,ans=0;
		for(int i=1;i<=n;i++){
			if(s[i]!=s[i-1]){
				ans+=cnt/2;
				cnt=1;
			}
			else cnt++;
		}
		ans+=cnt/2;
		printf("%lld\n",ans*k);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  int x[n];
  ll sum = 0;
  rep(i, n) {
    cin >> x[i];
    sum += x[i];
  }
  int ave_1 = sum / n;
  int ave_2 = ave_1 + 1;

  ll ans_1 = 0, ans_2 = 0;
  rep(i, n) {
    ans_1 += pow(x[i] - ave_1, 2);
    ans_2 += pow(x[i] - ave_2, 2);
  }
  ll ans = min(ans_1, ans_2);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    string c, d;
    int cnt = 0;
    while (a <= b)
    {
        c = to_string(a);
        d = c;
        reverse(c.begin(), c.end());
        if (c == d)
            cnt++;
        a++;
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
// Problem : C - : (Colon)
// Contest : AtCoder - AtCoder Beginner Contest 168
// URL : https://atcoder.jp/contests/abc168/tasks/abc168_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
template<int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template<typename... Args>
  Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
  }
};
template<typename T>
struct Vec<1, T> : public vector<T> 
{
  Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {}
};
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
    return (x>=0 and y>=0 and x<n and y<m);
}
vector<bool> isprime;
vector<ll> prime;
void sievetoprime(ll n)
{
    isprime.resize(n+1,true);
    for(ll p=2;p*p<=n;p++)
    {
        if(isprime[p]==true)
        {
            for(ll i=p*p;i<=n;i+=p)
                isprime[i]=false;
        }
    }
    for(ll i=1;i<=n;i++)
    {
    	if(isprime[i])
    		prime.pb(i);
    }
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
//Disjoint-Set Union-find algorithm
void initialize_disjoint_set(vector<ll> &arr,vector<ll> &size,ll n)
{
	for(ll i=0;i<n;i++)
    {
		arr[i] = i ;
		size[i] = 1;
	}
}
ll root(vector<ll> &arr,ll i)
{
    while(arr[i] != i)
    {
		i=arr[i]; 
    }
	return i;
}

void unione(vector<ll> &arr,vector<ll> &size,ll a,ll b)
{
    ll root_A = root(arr,a);
    ll root_B = root(arr,b);
    if(size[root_A] < size[root_B ])
    {
		arr[root_A] = arr[root_B];
		size[root_B] += size[root_A];
	}
    else
    {
		arr[ root_B ] = arr[root_A];
		size[root_A] += size[root_B];
	}	
}
// Vec<1,ll> v(n,0);
void solve()
{
    ll a,b,h,m;
    cin>>a>>b>>h>>m;
    if(a<b)
    	swap(a,b);
    ld th=30*h+(m*1.0/2);
    ld tm=6*m;
    ld diff=abs(th-tm);
    if(diff>180)
    	diff=360-diff;
    //cout<<diff<<" ";
    ld st=sin((diff*M_PI*1.0)/180);
    ld ct=cos((diff*M_PI*1.0)/180);
    /*if(st<1e-9)st=0.0;
    if(ct<1e-9)ct=0.0;*/
    ld ans=a*a+b*b-2*a*b*ct;
    ans=sqrt(ans);
	cout<<fixed<<setprecision(10)<<ans;
}
int main()
{
    ll inpoup = 0;
    if(inpoup==1)
    {
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
    }
    IOS
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 4148
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
#define fs first
#define se second

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
typedef pair<ld, ld> pdd;

const int mod = 1e9 + 7;
int n;
char S[2][53];
int dp[3][3], tp[3][3];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> S[0] >> S[1];
    if (S[0][0] == S[1][0]) {
        for (int i = 0; i < 3; ++i) dp[i][i] = 1;
    }
    else {
        for (int i = 0; i < 3; ++i) {
            for (int j = 0; j < 3; ++j) {
                if (i != j) dp[i][j] = 1;
            }
        }
    }
    for (int i = 1; i < n; ++i) {
        for (int a = 0; a < 3; ++a) {
            for (int b = 0; b < 3; ++b) {
                for (int c = 0; c < 3; ++c) {
                    for (int d = 0; d < 3; ++d) {
                        if ((S[0][i] != S[1][i]) != (c != d)) continue;
                        if ((S[0][i - 1] != S[0][i]) != (a != c)) continue;
                        if ((S[1][i - 1] != S[1][i]) != (b != d)) continue;
                        tp[c][d] += dp[a][b];
                        tp[c][d] %= mod;
                    }
                }
            }
        }
        for (int a = 0; a < 3; ++a) {
            for (int b = 0; b < 3; ++b) {
                dp[a][b] = tp[a][b];
                tp[a][b] = 0;
            }
        }
    }
    int ans = 0;
    for (int a = 0; a < 3; ++a) {
        for (int b = 0; b < 3; ++b) {
            ans += dp[a][b];
            ans %= mod;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
import math
import itertools
def gcd(lst):
  return math.gcd(math.gcd(lst[0],lst[1]), lst[2])

k = int(input())
lst = [i for i in range(1,k+1)]
itr = itertools.combinations_with_replacement(lst, 3)
ans = 0

for i in itr:
  st = set(i)
  num = len(st)
  if num == 1:
    ans += i[0]
  elif num == 2:
    a,b = st
    ans += math.gcd(a,b) * 3
  else:
    ans += math.gcd(math.gcd(i[0],i[1]), i[2]) * 6

print(ans)

Measured memory_bytes: 74148
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
const int inf=1e18;
int n,m,q,ans=0;
int a[55][4];
int ar[15];
void f(int l,int p){
	if(p==n+1){
		int sum=0;
		for(int i=0;i<q;i++){
			if(ar[a[i][1]]-ar[a[i][0]]==a[i][2])
				sum+=a[i][3];
		}
		ans=max(ans,sum);
		return;
	}
	for(int i=l;i<=m;i++){
		ar[p]=i;
		f(i,p+1);
	}
}
int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    cin >> n >> m >> q;
    for(int i=0;i<q;i++){
    	for(int j=0;j<4;j++)
    		cin >> a[i][j];
    }
    f(1,1);
    cout << ans;
}

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

int main() {
  int n;
  cin>>n;
  vector<char> alp = {
    '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'
  };
  string s;
  cin>>s;
  int k = s.size();
  vector<char> a(k);
  for (int i=0;i<k;i++) {
    a[i] = s[i];
  }
  for (int i=0;i<k;i++) {
    for (int j=0;j<26;j++) {
      if (a[i] == alp[j]) {
        if (j+n < 26) cout<<alp[j + n];
        else cout<<alp[(j + n) % 26];
      }
    }
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,a,b;
    bool flag=false;
    cin>>a>>b;

    for(int i=1;i<=1000;i++){
        if(i*8/100==a&&i*10/100==b){
            ans=i;
            flag=true;
            break;
        }
    }

    {
        if(flag)cout <<ans<<endl;
        else cout <<"-1"<<endl;
    }

    dbg cout <<ans<<endl;

    return 0;

}

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

#define INF 999999999999

using namespace std;

int main()
{
	int ans = 0;
	int N = 0;
	vector<int> V(60);
	vector<int> C(60);
	vector<int> S(60);
	int max = INF;

	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> V[i];
	for (int i = 0; i < N; i++)
		cin >> C[i];

	//差を求める
	for (int i = 0; i < N; i++)
		S[i] = V[i] - C[i];

	sort(S.begin(), S.end(), std::greater<int>());

	for (int i = 0; i < N; i++)
	{
		if (S[i] < 0)
			break;

		ans += S[i];
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

  int data[5], d[3];

  while(1){

    for(int i = 0; i < 3; i++) d[i] = 0;


    for(int i = 0; i < 5; i++){
      cin >> data[i];
      if(data[0] == 0) return 0;
      if(data[i] == 1) d[0]++;
      else if(data[i] == 2) d[1]++;
      else d[2]++;
    }

      if(d[0] > 0 && d[1] > 0 && d[2] > 0 || d[0] == 5 || d[1] == 5 || d[2] == 5){
	for(int j = 0; j < 5; j++) cout << "3" << endl;
      }else if(d[0] == 0){
	for(int j = 0; j < 5; j++){
	  if(data[j] == 2) cout << "1" << endl;
	  else cout << "2" << endl;
	}
      }else if(d[1] == 0){
	for(int j = 0; j < 5; j++){
	  if(data[j] == 3) cout << "1" << endl;
	  else cout << "2" << endl;
	}
      }else{
	for(int j = 0; j < 5; j++){
	  if(data[j] == 1) cout << "1" << endl;
	  else cout << "2" << endl;
	}
      }
  }
}

Measured memory_bytes: 0
import math
for _ in range(int(input())):
    a, b = map(int, input().split())
    a, b = max(a, b), min(a, b)
    p = a * b
    x = int(math.sqrt(p - 1))
    while x * x >= p:
        x -= 1
    c = x * 2
    if x * (x + 1) >= p:
        c -= 1
    if a <= x:
        c -= 1
    if b <= x:
        c -= 1
    print(c)


Measured memory_bytes: 3064
use std::io::prelude::*;
use std::cmp::{min, max};

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

static INF: i64 = 100_000_000;

fn main() {
    let n = input::<usize>();
    let m = input::<usize>();
    let v = (0..m)
        .map(|_| (input::<usize>()-1, input::<usize>()-1, input()))
        .collect::<Vec<(_, _, i64)>>();

    let mut d = vec![vec![INF; 100]; 100];


    for  i in 0..n {
        d[i][i] = 0;
    }

    for &(a, b, c) in &v {
        d[a][b] = min(d[a][b], c);
        d[b][a] = min(d[b][a], c);
    }

    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                d[i][j]=min(d[i][j], d[i][k]+d[k][j]);
            }
        }
    }

    let mut ans = m;
    for &(a, b, c) in &v {
        let shortest = || -> bool {
            for j in 0..n {
                if d[j][a] + c == d[j][b] {
                    return true;
                }
            }
            false
        };
        if shortest() {
            ans-=1;
        }
    }
    println!("{}", ans);
}


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

int main() {
  int a,b,c,d;cin>>a>>b>>c>>d;
  if (a+b==c+d) {
    cout << "Balanced" << endl;
  } else if (a+b<c+d) {
    cout << "Right" << endl;
  } else {
    cout << "Left" << endl;
  }
}


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

int main(){
    int dp[100100];

    dp[0] = 0;
    for(int n = 1; n <= 100000; n++)
    {
        dp[n] = 1e7;
        int power = 1;
        while(power <= n){
            dp[n] = min(dp[n], dp[n-power]+1);
            power *= 6;
        }
        power = 1;
        while(power <= n){
            dp[n] = min(dp[n], dp[n-power]+1);
            power *= 9;
        }        
    }
    int n;
    cin >> n;
    cout << dp[n] << endl;
    
    return 0;
}

Measured memory_bytes: 640
# 数値→アルファベット
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

N = int(input())
print(num2alpha(N).lower())

Measured memory_bytes: 9164
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <tuple>
template <typename T> constexpr T my_abs(const T &x) { return x < 0 ? -x : x; }
using ll = long long;
int lst[100005], to[200005], pre[200005], tot;
int deg[100005], seq[200005], node[200005], len;
bool vis[100005];
inline void add_edge(int u, int v)
{
	to[tot] = v;
	pre[tot] = lst[u];
	lst[u] = tot++;
}
void euler(int u)
{
	while (~lst[u])
	{
		int e = lst[u];
		lst[u] = pre[e];
		if (vis[e >> 1])
			continue;
		vis[e >> 1] = true;
		euler(to[e]);
		seq[len++] = to[e];
	}
}
int main()
{
	// freopen("AGC032-C.in", "r", stdin);
	memset(lst, -1, sizeof(lst));
	int n, m, cnt = 0;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		deg[--u]++;
		deg[--v]++;
		add_edge(u, v);
		add_edge(v, u);
	}
	for (int i = 0; i < n; i++)
	{
		if (deg[i] & 1)
		{
			puts("No");
			return 0;
		}
	}
	for (int i = 0; i < n; i++)
	{
		if (deg[i] >= 6)
		{
			puts("Yes");
			return 0;
		}
		if (deg[i] == 4)
			node[cnt++] = i;
	}
	if (cnt >= 3)
		puts("Yes");
	else if (cnt <= 1)
		puts("No");
	else
	{
		euler(0);
		bool app_u = false, app_v = false, ok = true;
		for (int i = 0; i < len; i++)
		{
			if (seq[i] == node[0])
			{
				if (!app_u)
					app_v = false;
				else
					ok &= !app_v;
				app_u ^= 1;
			}
			app_v ^= seq[i] == node[1];
		}
		puts(ok ? "Yes" : "No");
	}
	return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
int solve(int n, int x){
    int ans=0, i, j, k;
    for(i=1;i<=n-2;i++){
        for(j=i+1;j<=n-1;j++){
            for(k=j+1;k<=n;k++){
                if(i+j+k==x) ans++;
            }
        }
    }
    cout << ans <<endl;
    return 0;
}
int main(){
    while(1){
        int n, x;
        cin >> n >> x;
        if(n==0 && x==0) return 0;
        solve(n, x);
    }
    return 0;
}


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


Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.size()-1; i++){
        if(s[i] != s[i+1]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
x, len = gets.split.map(&:to_i)
min = 100
result = 0

if len == 0
  puts x
else
  arr = gets.split.map(&:to_i)
  (0..101).reverse_each do |i|
  	if arr.include?(i)
    	next
  	end
  
  	if (x-i).abs <= min then
    	min = (x-i).abs
    	result = i
  	end
  end

  puts result
end

Measured memory_bytes: 14236
#include <stdio.h>
int main()
{
    char s[10];
    scanf("%s", s);
    if(s[0] == 'S'){
        printf("Cloudy\n");
    }
    if (s[0] == 'C')
    {
        printf("Rainy\n");
    }
    if (s[0] == 'R')
    {
        printf("Sunny\n");
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		char[] c = str.toCharArray();

		for(int i = 0; i < c.length; i++){
			int count = 0;
			for(int j = 0; j < c.length; j++){
				if(c[i] == c[j]){
					count ++;
				}
			}
			if(count % 2 != 0){						
				System.out.println("No");
				System.exit(0);
			}
		}
		System.out.println("Yes");
	}
}


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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

ll s , c ;

int main() {
  cin >> s >> c ;
  if( c / 2 >= s ){
     if( c % 2 ) c-- ;
     cout << s + ( c / 2 - s ) / 2 ;
  } else {
    cout << c / 2 ;
  }
  return 0 ;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), M = sc.nextInt();
		int A[] = new int[N];
		for(int i=0;i<N;i++) A[i]=sc.nextInt();
		sc.close();
		
		//test
//		int N = (int)1e5;
//		int M = (int)1e4;
//		int A[] = new int[N];
//		Arrays.fill(A, 2);
		
		
		int sum[] = new int[N];
		sum[0]=A[0]%M;
		for(int i=1;i<N;i++) {
			sum[i] =  (sum[i-1] + A[i])% M;
		}
		Map<Integer,Long> map = new HashMap<Integer,Long>();
		for(int i=0;i<sum.length;i++) {
			if(map.containsKey(sum[i])) {
				long now = map.get(sum[i]); 
				map.put(sum[i],++now);
			}else {
				map.put(sum[i], 1L);
			}
		}
		long ans = 0;
		//map は　keySetを利用して全操作する。
		for(int key:map.keySet()) {
			long value = map.get(key);
			long add = (value-1)*value/2;
			ans += add;
		}
		//0の時だけ自分自身だけでもカウント出来る。
		if(map.containsKey(0))ans += map.get(0);
		System.out.println(ans);
	}
}


Measured memory_bytes: 52104
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,m;
    cin >> n >> m;

    if(n==1&&m==1){
        cout << 1;
        return 0;
    }

    if(n==1){
        cout << m-2;
        return 0;
    }
    if(m==1){
        cout << n-2;
        return 0;
    }

    cout << (n-2)*(m-2);
    return 0;
}

Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		int[] sortList = new int[count];
		for(int i = 0; i < count; i++){
			sortList[i] = scanner.nextInt();
		}
		int anser = bubbleSort(sortList, count);
		for(int i = 0; i < count; i++){
			if(i != count - 1){
				System.out.print(sortList[i] + " ");
			}else{
				System.out.println(sortList[i]);
			}
		}
		System.out.println(anser);
	}

	private static int bubbleSort(int[] sortList, int count){
		int exchange_count = 0;
		int temp = 0;
		for(int j = 0; j < count; j++){
			for(int i = count - 1; i > j; i--){
				if(sortList[i] < sortList[i - 1]){
					temp = sortList[i];
					sortList[i] = sortList[i - 1];
					sortList[i - 1] = temp;
					exchange_count++;
				}
			}
		}
		return exchange_count;
	}
}

Measured memory_bytes: 26328
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int h,w;
string s[60];
int dx[] = {0,1,1,1,0,-1,-1,-1}, dy[] = {1,1,0,-1,-1,-1,0,1};
vector<vector<int>> v(60, vector<int>(60, -1));
int search(int i ,int j){
    int cnt = 0;
    for(int k = 0; k < 8 ; k ++){
        int nx = i + dx[k] , ny = j + dy[k];
        if(nx >= 0 && nx < h && ny >= 0 && ny < w){
            if(s[nx][ny] == '#') cnt++;
        }
    }
    if(i==1 && j==2) cout << endl;
    return cnt;
}
int main(){
    cout << fixed << setprecision(10);
    cin >> h >> w;
    rep(i,h)cin >> s[i];
    rep(i,h){
        rep(j,w){
            if(s[i][j] == '.') {
                v[i][j] = search(i,j);
            }
        }
    }
    rep(i,h){
        rep(j,w){
            if(v[i][j] == -1) cout << "#";
            else cout << v[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N;
  bool flg = false;
  cin >> N;
  for(int a=1;a<=9;a++){
    for(int b=1;b<=9;b++){
  		if(a*b==N) flg = true;
    }
  }
  if (!flg) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<30)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long


signed main(){
	int n;
	cin>>n;
	vector<pair<int,int>> v;
	lp(i,n){
		int a,b;
		cin>>a>>b;
		v.push_back({b,a});
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	int now=INF;
	string ans="Yes";
	lp(i,v.size()){
		now=min(v[i].first-v[i].second,now-v[i].second);
		if(now<0)ans="No";
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6564
/* Author : tushar3105 */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef pair<long long int,long long int> ii;					// Pair of integers
typedef vector<long long int> vi;                   				// Vector of integers
typedef vector<vector<long long int>> vvi;                 			// Vector of vi
typedef vector<pair<long long int, long long int>> vii;				// Vector of ii

#define pb push_back								// Push back to vectors
#define mp make_pair								// For pairs
#define ff first								// For pairs
#define ss second								// For pairs
#define all(c) (c).begin(),(c).end()						// Use in sorting
#define sz(a) ((long long int)(a).size())
#define lli long long int
#define ull unsigned long long int
#define ld long double
#define ref(i,x,y) for(long long int i=(x);i<=(y);++i)				// Loop to go forward
#define reb(i,x,y) for(long long int i=(x);i>=(y);--i)				// Loop to go backward
#define trf(c,it) for(auto it = (c).begin(); it != (c).end(); it++)		// Remember it is an iterator
#define trb(c,it) for(auto it = (c).end()-1; it != (c).begin()-1; it--)		// Remember it is an iterator
#define tc(t) long long int (t); cin>>(t);while((t)--)				// Test cases
//fill (dist,dist+110000,pinf);							// For setting default

const long long int mod = 1e9+7;
const long long int pinf = 9223372036854775807;
const long long int ninf = -9223372036854775807;

/*-----------------------------Code begins----------------------------------*/

int main (void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	
	lli x;
	cin>>x;
	
	if (x<600)
		cout<<8<<endl;
		
	else if (x<800)
		cout<<7<<endl;
	
	else if (x<1000)
		cout<<6<<endl;
	
	else if (x<1200)
		cout<<5<<endl;
	
	else if (x<1400)
		cout<<4<<endl;
	
	else if (x<1600)
		cout<<3<<endl;
	
	else if (x<1800)
		cout<<2<<endl;
	
	else if (x<2000)
		cout<<1<<endl;

	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <stack>

using namespace std;

int main()
{
	int n;
	string s;
	cin >> n >> s;

	stack<char> c;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			c.push('(');
		} else {
			if (c.empty()) {
				cout << '(';
			} else {
				c.pop();
			}
		}
	}
	cout << s;
	while (!c.empty()) {
		cout << ')';
		c.pop();
	}


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N, K;
	cin >> N >> K;
	VLL check(N,0);
	for (LL k = 0; k < K; k++) {
		LL D;
		cin >> D;
		for (LL d = 0; d < D; d++) {
			LL a;
			cin >> a;
			check[a - 1]++;
		}
	}
	LL ans = 0;
	for (LL n = 0; n < N; n++) {
		if (check[n] == 0)ans++;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e10,EPS=1e-9;

int main()
{
	int cs; scanf("%d",&cs);
	while(cs--)
	{
		int x,y,w,h,n; scanf("%d%d%d%d%d",&x,&y,&w,&h,&n);
		int ans=0;
		rep(i,n)
		{
			int cx,cy; scanf("%d%d",&cx,&cy);
			if(x<=cx&&cx<=x+w&&y<=cy&&cy<=y+h)ans++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
/// sultanov

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
     
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
using namespace __gnu_pbds;
                                                          
template<typename T> 
using ordered_set = tree<T, null_type,   
less<T>, rb_tree_tag,
tree_order_statistics_node_update>;

using ll = long long;
using pii = pair<int, int>;                                   

const int INF32 = 1e9;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);          
    int n, m;
    cin >> n >> m;
    vector<int> a(m), bit(m);
    for (int i = 0, b; i < m; i++) {
        cin >> a[i] >> b;
        for (int x; b--;) {
            cin >> x;
            bit[i] |= (1 << (x - 1));
        }
    }
    vector<int> dp(1 << n, INF32);
    dp[0] = 0;
    for (int mask = 0; mask < (1 << n); mask++) 
        for (int i = 0; i < m; i++)
            dp[mask | bit[i]] = min(dp[mask | bit[i]], dp[mask] + a[i]);
    cout << (dp.back() == INF32 ? -1 : dp.back());
    return false;                                                       
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll A[200000];

int main(){
    ll N,K;
    cin >> N >> K;
    for(int i=0;i<N;i++) cin >> A[i];
    for(int i=K;i<N;i++){
        if(A[i] > A[i-K]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 5192
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
  ll A,B,C,D;
  cin >> A >> B >> C;
  D = C - (A - B);
  if(D<0) cout << 0;
  else cout << D;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void setHigher( int list[3], int highest, int higher2, int higher3 )
{
	list[2] = higher3;
	list[1] = higher2;
	list[0] = highest;
}

int main( void )
{
	int higher[3] = {0};
	int i;
	int buf;
	
	for( i = 0; i < 10; i++ )
	{
		scanf( "%d", &buf );
		if( buf > higher[0] )
		{
			setHigher( higher, buf, higher[0], higher[1] );
		}
		else if( buf > higher[1] )
		{
			setHigher( higher, higher[0], buf, higher[1] );
		}
		else if( buf > higher[2] )
		{
			setHigher( higher, higher[0], higher[1], buf );
		}
	}
	
	for( i = 0; i < 3; i++ )
	{
		printf("%d\n", higher[i] );
	}
	
	return (0);
}

Measured memory_bytes: 600