akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18
									   
//O(V^3) V=300程度か
template< typename T >
using Matrix = vector< vector< T > >;

template< typename T >
void warshall_floyd(Matrix< T > &g, T INF) {
	for (int k = 0; k < g.size(); k++) {
		for (int i = 0; i < g.size(); i++) {
			for (int j = 0; j < g.size(); j++) {
				//負の辺+INFをしてしまうとバグるので
				if (g[i][k] == INF || g[k][j] == INF) continue;
				g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
			}
		}
	}
}

//最短距離がマイナスになっていると負の閉路がある
//for (int i = 0; i < V; i++) {
//	if (mat[i][i] < 0) {
//		puts("NEGATIVE CYCLE");
//		return 0;
//	}
//}

//結果を改行して表示
//if (mat[i][j] == INT_MAX) {
//	cout << "INF" << endl;
//}
//else {
//	cout<<mat[i][j]<<endl;
//}

int main() {
	int V, E;
	cin >> V >> E;
	Matrix< int > mat(V, vector< int >(V, INT_MAX));
	for (int i = 0; i < V; i++) mat[i][i] = 0;

	
	vector<int> x(1000);
	vector<int> y(1000);
	vector<int> z(1000);

	for (int i = 0; i < E; i++) {
		cin >> x[i] >> y[i] >> z[i];
		x[i]--; y[i]--;
		mat[x[i]][y[i]] = z[i];
		mat[y[i]][x[i]] = z[i];
	}
	warshall_floyd(mat, INT_MAX);

	int ans = E;
	for (int i = 0; i < E; i++) {
		bool shortest = false;

		if (mat[x[i]][y[i]] == z[i])shortest = true;

		if (shortest == true) {
			ans--;
		}
	}

	cout << ans << endl;

}



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

typedef long long ll;
///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Macro Start-*-*-*-*-*-*-*--*-*-*-*-*/

#define Faster_IO              ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F                      first
#define S                      second
#define pb                     push_back
#define MP                     make_pair
#define sf                     scanf
#define pf                     printf
#define pi                     (2*acos(0))
#define to_radian(degree)      ((pi/180)*degree)
#define to_degree(radian)      ((180/pi)*radian)
#define SQ(a)                  (a)*(a)
#define SORT(x)                sort(x.begin(),x.end())
#define SetPrint(a,x)          cout<<fixed<<setprecision(x)<<a<<endl
#define READ(x)                freopen(x,"r",stdin)
#define show(vec)              for (auto it = vec.begin(); it != vec.end(); it++)cout << *it << " ";
#define YES                    printf("YES\n")
#define NO                     printf("NO\n")
#define Yes                    printf("Yes\n")
#define No                     printf("No\n")
#define tc(n)                  int n; cin >> n; while(n--)
#define lcm(a,b)               ((a / __gcd(a,b) ) * b)
#define gcd(a,b)               __gcd(a,b)
///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Macro END-*-*-*-*-*-*-*--*-*-*-*-*/

///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Template Start-*-*-*-*-*-*--*-*-*-*-*/

//template <class T> T isPrime(T n){if(n<=1)return 0;for(long long i=2;i*i<=n; i++)if(n%i==0)return 0;return 1;}
//template <class T> T bigmod(T X, T n, T M) {if (n==0) return 1;if (n%2) return ((X%M) * bigmod(X,n-1,M)) %M;else {long long int d = bigmod(X,n/2, M);return ((d%M) * (d%M))%M;}}

///*-*-*-*-*-*-*-*-*-*-*-*-*-*-Template END-*-*-*-*-*-*-*--*-*-*-*-*/

using namespace std;

int main()
{
    Faster_IO
    #ifndef ONLINE_JUDGE
    freopen("Input.txt", "r", stdin);
    freopen("Output.txt", "w", stdout);
    #endif

    int s, w;

    cin >> s >> w;
    if(w>=s)
        cout << "unsafe"<<"\n";
    else
        cout <<"safe" << "\n";


   return 0;
}


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

int main()
{

	int N;
	int P[2 * 100000 + 1];

	cin >> N;
	int count = 0;
	int minNum = N + 1;

	for (int i = 0; i < N; i++)
	{
		cin >> P[i];
		if(P[i] < minNum){
			minNum = P[i];
			count++;
		}
	}

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int H, W;
  cin >> H >> W;
  int N;
  cin >> N;
  VEC<int> a(N);
  REP(i, 0, N) cin >> a[i];
  MAT<int> c = MATINIT(int, H, W, -1);
  int color = 0;
  int ed = 0;
  REP(h, 0, H) {
    if (h % 2 == 0) {
      REP(w, 0, W) {
        c[h][w] = color + 1;
        ++ed;
        if (ed >= a[color]) {
          ++color;
          ed = 0;
        }
      }
    } else {
      for (int w = W - 1; w >= 0; --w) {
        c[h][w] = color + 1;
        ++ed;
        if (ed >= a[color]) {
          ++color;
          ed = 0;
        }
      }
    }
  }
  REP(h, 0, H) {
    REP(w, 0, W) cout << c[h][w] << " ";
    cout << endl;
  }

  return 0;
}


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

using namespace std;
typedef long long LL;
// typedef pair<double, double> P;
// typedef pair<P, LL> PP;

// vector<P> px(110000);
// vector<P> py(110000);
int a[300000];
int b[300000];
int main() {
  // #ifndef ONLINE_JUDGE
  //freopen("input", "r", stdin);
  //std::vector<int> v;
  //freopen("output", "w", stdout);
  int n,m;
  cin>>n>>m;
  int k=0;
  for(int i=0;i<m;i++)
  {
    int t1,t2;
    cin>>t1>>t2;
    if(t1>t2)swap(t1,t2);
    if(t1==1)b[k++]=t2;
    if(t2==n)a[t1]=1;
  }
  for(int i=0;i<k;i++)
  {
  if(a[b[i]]){cout<<"POSSIBLE"<<endl;return 0;}}
  cout<<"IMPOSSIBLE"<<endl;
  return 0;

  }


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007 
#define int long long
#define ll long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define mii map<int,int>
#define vp vector<pair< int,int> >
#define mpi map<pair<int,int> ,int>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repi(i,a,b) for(int i=a;i>=b;i--)
#define fill(a,i) memset(a,i,sizeof a);


void solve()
{ 
    int l=1,r=1e9;
    int n,k;cin>>n>>k;
    int ff=-1;
    int A[n+5];rep(i,1,n){cin>>A[i];ff=max(ff,A[i]);}
    
    
    while(l<=r)
    {
        int mid=(l+r)/2;
        int cnt=0;int rr=0;
        rep(i,1,n)
        {
            cnt+=A[i]/(mid);
            if(A[i]%mid==0)cnt--;
        }
      // cout<<mid<<" "<<cnt<<endl;
        if(cnt<=k)
        {
            ff=mid;
            r=mid-1;
        }
        else l=mid+1;
    }
    cout<<ff<<endl;
}

signed main()
{ 
    boost
    int test=0,t;
    //cin >> t ;
    t=1;
    while(test++ <t){
    //cout<<"Case #"<<test<<": ";
    solve();}
  
}

Measured memory_bytes: 5092
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
using ii = pair<int, int>;

constexpr int HOGE = 1e17 + 100;
int exp1(const string& s, int& i, int r);
int exp2(const string& s, int& i, int r);
int exp1(const string& s, int& i, int r) {
    int acc = exp2(s, i, r);
    while (i < r) {
        if (s[i] == '+') {
            acc += exp2(s, ++i, r);
        } else if (s[i] == '-') {
            acc -= exp2(s, ++i, r);
        } else
            return acc;
        // assert(0);
    }
    return acc;
}
int exp2(const string& s, int& i, int r) {
    if (s[i] == '(') {
        int ret = exp1(s, ++i, r);
        assert(s[i++] == ')');
        return ret;
    }
    if (isdigit(s[i])) return s[i++] - '0';
    // assert(0);
    return exp1(s, i, r);
}
bool is_valid(const string& s, int i, int r) {
    int acc = 0;
    for (int j = i; j < r; j++) {
        if (s[j] == '(') acc++;
        if (s[j] == ')') acc--;
        if (acc < 0) return false;
    }
    return acc == 0;
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;
    vector<int> num, idx, op_idx;
    op_idx.push_back(-1);
    vector<char> ops;
    REP(i, s.size()) {
        if (isdigit(s[i])) {
            num.push_back(s[i] - '0');
            idx.push_back(i);
        }
        if (s[i] == '+' || s[i] == '-') {
            ops.push_back(s[i]);
            op_idx.push_back(i);
        }
    }
    op_idx.push_back(s.size());

    auto valid = [&](int i) { return 0 <= i && i < s.size(); };

    constexpr ii DMY = {1e17, 1e17};
    int m = num.size();
    vector<vector<ii>> dp(m, vector<ii>(m, DMY));
    function<ii(int, int)> dfs = [&](int i, int j) {
        if (dp[i][j] != DMY) return dp[i][j];
        if (i == j) return dp[i][j] = {num[i], num[i]};
        int mi = 1e18, ma = -1e18;
        int l_idx = idx[i];
        int r_idx = idx[j];
        if (is_valid(s, l_idx, r_idx + 1)) {
            mi = ma = exp1(s, l_idx, r_idx + 1);
        }
        for (int k = i; k < j; k++) {
            if (k != i && valid(idx[k] - 1) && s[idx[k] - 1] == '(') continue;
            if (k != j - 1 && valid(idx[k + 1] + 1) && s[idx[k + 1] + 1] == ')') continue;
            ii l = dfs(i, k);
            ii r = dfs(k + 1, j);
            if (ops[k] == '+') {
                mi = min(mi, l.fi + r.fi);
                ma = max(ma, l.se + r.se);
            } else {
                // assert(ops[k] == '-');
                mi = min(mi, l.fi - r.se);
                ma = max(ma, l.se - r.fi);
            }
        }
        return dp[i][j] = {mi, ma};
    };
    dfs(0, m - 1);
    cout << dp[0][m - 1].se << endl;
}



Measured memory_bytes: 3316
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;


public class Main {



	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		TreeMap<String, Integer[]> map = new TreeMap<>();
		
		int max = 0;
		
		for (int i=0;i<n;i++) {
			String s = sc.next();
			if(!map.containsKey(s)) {
				map.put(s, new Integer[1]);
				map.get(s)[0]=0;
			}
			map.get(s)[0]++;
			max = Math.max(max, map.get(s)[0]);
		}
		
		for (Map.Entry<String, Integer[]>e : map.entrySet()) {
			if (e.getValue()[0]==max) {
				System.out.println(e.getKey());
			}
		}
	}

}

Measured memory_bytes: 88436
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;

int main(){

	ll z;
	while(cin>>z&&z!=0){
		const ll zzz=z*z*z;
		ll maxNum=0;
		for(ll i = 1; i < z; i++){
			ll prv=i*i*i;
			for(ll j = 1; j < z; j++){
				ll nxt=j*j*j;
				if(nxt+prv>zzz)
					break;
				maxNum=max(maxNum,nxt+prv);
			}
		}
		cout<<zzz-maxNum<<endl;
	}

	return 0;
}

Measured memory_bytes: 860
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
using namespace std;

const int MX = 1e5 + 5;
int dp[MX][105];
int n,w;
vector<int> weights;
vector<int> values;

int solve(int acc_w,int ind){
    if(acc_w > w) return -1e17;
    if(ind == n+1) return 0;
    if(dp[acc_w][ind] != -1) return dp[acc_w][ind];
    int ans = -1e17;
    ans = max(ans, solve(acc_w,ind + 1));
    ans = max(ans, solve(acc_w + weights[ind],ind + 1) + values[ind]);
    return dp[acc_w][ind] = ans;
}

int32_t main()
{
    cin>>n>>w;
    weights.resize(n+1);
    values.resize(n+1);
    memset(dp, -1, sizeof dp);
    for(int i = 1 ; i <= n ; i++) cin>>weights[i]>>values[i];
    cout<<solve(0, 1);
    return 0;
}


Measured memory_bytes: 85672
import math
import fractions
#import sys
#input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ZipArray(a):
    aa = [[a[i],i]for i in range(n)]

    aa.sort(key = lambda x : x[0])
    for i in range(n):
        aa[i][0]=i+1
    aa.sort(key = lambda x : x[1])
    b=[aa[i][0] for i in range(len(a))]
    return b

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans

def Zeros(a,b):
    if(b<=-1):
        return [0 for i in range(a)]
    else:
        return [[0 for i in range(b)] for i in range(a)]

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

def rln(s):
    return range(len(s))

#a = list(map(int, input().split()))

#################################################
#################################################
#################################################
#################################################

class NB:
    v=0
    d=0

n = int(input())
nb = [[] for i in range(n)]
for i in range(n-1):
    a,b,c = list(map(int, input().split()))
    nbi = NB()
    nbi.v = b-1
    nbi.d = c
    nb[a-1].append(nbi)
    nbi = NB()
    nbi.v = a-1
    nbi.d = c
    nb[b-1].append(nbi)

q,k = list(map(int, input().split()))

queue = [k-1]
done = 0
dist = [0 for i in range(n)]

while(len(queue)>done):
    now = queue[done]
    for i in nb[now]:
        if(dist[i.v]==0 and i.v!=k-1):
            dist[i.v] = dist[now]+i.d
            queue.append(i.v)
    done+=1
#print(dist)

for i in range(q):
    a,b=list(map(int, input().split()))
    print(dist[a-1]+dist[b-1])








































Measured memory_bytes: 117404
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
int main(){
  string s;
  cin>>s;
  string ans="";
  if(s=="Sunny") ans = "Cloudy";
  if(s=="Cloudy") ans = "Rainy";
  if(s=="Rainy") ans = "Sunny";
  cout<<ans<<endl;
}

Measured memory_bytes: 256
/**
*	created: 21.08.2020 16:58:39
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = LLONG_MAX;
const int MOD = 1000000007;
// const int MOD = 998244353;

int dp[111][111111] = {0};

signed main() {

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

    int n, W; cin >> n >> W;
    vector<int> w(n), v(n);
    rep(i,n) cin >> w[i] >> v[i];
    rep(i,n) rep(j,W+1) {
        if (j - w[i] >= 0) chmax(dp[i+1][j], dp[i][j-w[i]]+v[i]);
        chmax(dp[i+1][j],dp[i][j]);
    }
    cout << dp[n][W] << endl;
    return 0;
}


Measured memory_bytes: 81912
#include<stdio.h>
void MIYASUKU(int[],int);
void sort(int[],int);
main(){
	int n,i;
	int a[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		}
	
	MIYASUKU(a,n);
	sort(a,n);
}

void MIYASUKU(int a[1000],int n){
	int i;
	for(i=0;i<n;i++){
		if(i>0)printf(" ");
		printf("%d",a[i]);
		}
	printf("\n");
}

void sort(int a[1000],int n){
	int i,v,j;
	for(i=1;i<n;i++){
		v=a[i];
		j=i-1;
		while(j>=0&&a[j]>v){
			a[j+1]=a[j];
			j--;
		}
	a[j+1]=v;
	MIYASUKU(a,n);
	}
}


Measured memory_bytes: 2104
n = int(input())
ans = 0

for i in range(1,n+1):
    if i % 2 == 0:
        continue
    cnt = 0
    for j in range(1,i+1):
        if i % j == 0:
            cnt += 1
    if cnt == 8:
        ans += 1

print(ans)

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

int main(){
    double n;
    cin >> n;

    double sum = 0;
    for(int i = 0; i < n; i++){
        double s;
        cin >> s;
        sum += 1 / s;
    }
  cout << fixed << setprecision(6);
    cout << 1 / sum << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
#include <string>
#define int long long
#define P pair<int,int>
#define V vector<int>
#define rep(i,n) for(int i=0;i<n;i++)
#define vsort(vec) sort(vec.begin(),vec.end())
using namespace std;
signed main() {
	int cnt = 0;
	bool b = false;
	string s;
	cin >> s;
	while (1) {
		if (cnt == s.size()) {
			b = true;
			break;
		}
		if (cnt + 10 <= s.size() && s.substr(cnt, 11) == "dreameraser") {
			cnt += 11;
		}
		else if (cnt + 9 <= s.size() && s.substr(cnt, 10) == "dreamerase") {
			cnt += 10;
		}
		else if (cnt + 6 <= s.size() && s.substr(cnt, 7) == "dreamer") {
			cnt += 7;
		}
		else if (cnt + 4 <= s.size() && s.substr(cnt, 5) == "dream") {
			cnt += 5;
		}
		else if (cnt + 5 <= s.size() && s.substr(cnt, 6) == "eraser") {
			cnt += 6;
		}
		else if (cnt + 4 <= s.size() && s.substr(cnt, 5) == "erase") {
			cnt += 5;
		}
		else {
			break;
		}
	}
	if (b)cout << "YES" << endl;
	else cout << "NO" << endl;
	system("PAUSE");
	return 0;
}


Measured memory_bytes: 760
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int n;
int a[5001];
int b[5001];
int s;
int main()
{
	while(cin >> n && n>0)
	{
		b[0]=0;
		cin >> a[1];
		b[1]=a[1];
		s=b[1];
		for(int i=2; i<=n; i++)
		{
			cin >> a[i];
			b[i]=b[i-1]+a[i];
			for(int j=0; j<i; j++)
			{
				s=max(s, b[i]-b[j]);
			}	
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
<?php
/*
    Problem URL : http://arc071.contest.atcoder.jp/tasks/arc071_b

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d %d", $n, $m);

define('MOD', pow(10, 9) + 7);

$ans = 0;

$xx = explode(" ", trim(fgets(STDIN)));
$yy = explode(" ", trim(fgets(STDIN)));

$bx = array();
$by = array();
for ($i = 0; $i < $n - 1; $i++) {
    $bx[$i] = ($i + 1) * ($n - $i - 1);
}
for ($i = 0; $i < $m - 1; $i++) {
    $by[$i] = ($i + 1) * ($m - $i - 1);
}
for ($x = 0; $x < $n - 1; $x++) {
    $dx = $xx[$x+1] - $xx[$x];
    $total_x += $bx[$x] * $dx;
    $total_x %= MOD;
}
for ($y = 0; $y < $m - 1; $y++) {
    $dy = $yy[$y+1] - $yy[$y];
    $total_y += $by[$y] * $dy;
    $total_y %= MOD;
}

$ans = $total_x * $total_y % MOD;

echo $ans . PHP_EOL;


Measured memory_bytes: 31212
#include <iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i) 

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int ans = c - (a - b);

	if (ans<=0) {
		cout << 0 << endl;
	}
	else {
		cout << c - (a - b) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream> 
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	int i = 0,num,price = -2000000000,flag = 1;
	int mins, maxs = 0;
	int input;
	cin >> input;
	for(int i=0;i<input;i++){
		cin >> num;
		if (flag == 0) {
			maxs = num;
			price = max(price, maxs - mins);
			mins = min(mins, num);
		}
		if (flag == 1) {
			mins = num;
			flag = 0;
		}
		
	}
	cout << price<<endl;
}


Measured memory_bytes: 3124
#include<stdio.h>
#include<string.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i, j;
	char s[10004][11];
	for (i = 0; i < n; i++)
		scanf("%s", s[i]);
	int ans = 0;
	for (i = 0; i < n; i++)
		for (j = 0; j < strlen(s[i]) - 1; j++)
			if (s[i][j] == 'A' && s[i][j + 1] == 'B')
				ans++;
	int a, b, c;
	a = b = c = 0;
	for (i = 0; i < n; i++)
	{
		if (s[i][0] == 'B')
			b++;
		if (s[i][strlen(s[i]) - 1] == 'A')
			a++;
		if (s[i][0] == 'B' && s[i][strlen(s[i]) - 1] == 'A')
			c++;
	}
	if (a < b)
		ans += a;
	else if (a > b)
		ans += b;
	else if (a > 0)
	{
		if (a == c)
			ans += a - 1;
		else
			ans += a;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
using namespace std;

int main() {
  int N;
  cin >> N;

  int X[N], sum=0;
  rep(i,0,N-1) {
    cin >> X[i];
    sum += X[i];
  }

  int P1 = sum / N, P2 = sum / N + 1;
  int ans1=0, ans2=0;
  rep(i,0,N-1) {
    ans1 += pow(X[i] - P1, 2);
    ans2 += pow(X[i] - P2, 2);
  }

  cout << min(ans1, ans2) << endl;
  return 0;
}


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

using namespace std;

vector<string> vs = {"dream", "dreamer", "erase", "eraser"};

string s;
int lengthOfS;

bool solve(int n) {

    if (n == lengthOfS) {
        return true;
    }

    bool ok = false;

    for (const auto &v : vs) {

        if (s.substr(n, v.size()) == v) {

            ok = solve(n + v.size());
            if (ok) {
                break;
            }
        }
    }

    return ok;
}

int main() {

    cin >> s;
    lengthOfS = s.size();

    bool ok = solve(0);

    if (ok) {
        cout << "YES" << "\n";
    } else {
        cout << "NO" << "\n";
    }

    return 0;

}

Measured memory_bytes: 2048
n = int(input())
ansl = [0]*(n+1)
for x in range(1,10**2+1):
    for y in range(1,10**2+1):
        for z in range(1,10**2+1):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v <= n:
                ansl[v] += 1

for a in ansl[1:]:
    print(a)

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

typedef long long int ll;

int main(){
    int n , m , k , tot;
    cin >> n >> k;
    set <int> adj[n+5];
    map <pair<int , int >  ,int> mp;
    vector <pair <int , int> > v;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            if(j!=i){
                adj[i].insert(j);
            }
        }
    }
    tot = 0;
    for(int i = n; i >= 2; i--){
        for(int j = n; j >= 2; j--){
            if(tot==k){
                continue;
            }
            auto it = adj[i].find(j);
            if(i!=j && it != adj[i].end()){
            adj[i].erase(j);
            adj[j].erase(i);
            tot++;
            }
        }
    }
    if(tot != k){
        cout << "-1\n";
        return 0;
    }
    int ans = 0 ;
    for(int i = 1; i <= n; i++){
        auto it = adj[i].begin();
        while(it!=adj[i].end()){
            if(mp[{min(i , *it) , max(i , *it)}]==0){
            v.push_back({min(i , *it) , max(i , *it)});
            mp[{min(i , *it) , max(i , *it)}]++;
            ans++;
            }
            it++;
        }
    }
    cout << ans << '\n';
    for(int i = 0; i < v.size(); i++){
        cout << v[i].first << " " << v[i].second << '\n';
    }
}

Measured memory_bytes: 1152
use std::io::{stdin, Read};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();
    let t = read::<String>().chars().collect::<Vec<_>>();

    if s.len() != t.len() {
        println!("No");
        return;
    }

    let sn = convert(&s);
    let tn = convert(&t);

    for i in 0..s.len() {
        if sn[i] != tn[i] {
            println!("No");
            return;
        }
    }
    println!("Yes");

    use std::collections::HashMap;
    fn convert(v: &Vec<char>) -> Vec<i32> {
        let mut converted = vec![-1; v.len()];
        let mut table = HashMap::new();

        let mut id = 0;
        for i in 0..v.len() {
            let c = &v[i];
            if let Some(&id) = table.get(c) {
                converted[i] = id
            } else {
                id += 1;
                table.insert(c, id);
                converted[i] = id
            }
        }
        converted
    }
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int N;
  string S;
  cin >> N >> S;

  int ans = 1;
  for(int i = 0; i + 1 < N; i++){
    if(S[i] != S[i+1]){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
    //変数定義, 入力処理
    // vector<vector<int>> data(3, vector<int>(4)); //二次元配列
    int R;
    cin >> R;
    //処理

    //出力処理
    cout << fixed << setprecision(4) << R * 2 * M_PI << endl;
    return 0;
}


Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair((first), (second)))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int d(int num){
	int cnt = 0;
	while(num != 0){
		num /= 10;
		cnt++;
	}
	return cnt;
}

int main(){

	int N;
	cin >> N;
	int cnt = 0;
	for(int i = 1; i <= N; i++){
		if(d(i)%2 == 1)cnt++;
	}
	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long h, w;
  cin >> h >> w;
  long long res = h*w, a, b, c;
  for(int i = 1; i < h; i++){
    a = i*w;
    b = (h-i)*(w/2);
    c = (h-i)*(w-w/2);
    res = min(max({a, b, c}) - min({a, b, c}), res);
    b = ((h-i)/2)*w;
    c = ((h-i)-(h-i)/2)*w;
    res = min(max({a, b, c}) - min({a, b, c}), res);
  }
  for(int j = 1; j < w; j++){
    a = h*j;
    b = (w-j)*(h/2);
    c = (w-j)*(h-h/2);
    res = min(max({a, b, c}) - min({a, b, c}), res);
    b = ((w-j)/2)*h;
    c = ((w-j)-(w-j)/2)*h;
    res = min(max({a, b, c}) - min({a, b, c}), res);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;

vector<ll> G[10010];
bool t[10010];
ll ans[10010], idx;
ll n, a[10010], b[10010], c[10010], c_sum = 0;

void dfs(int v) {
    ans[v] = c[idx];
    t[v] = false;
    idx--;
    for (int i = 0; i < G[v].size(); i++) {
        if (t[G[v][i]]) dfs(G[v][i]);
    }
}



int main(void){
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        cin >> a[i] >> b[i];
        a[i]--;  b[i]--;
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    for (int i = 0; i < n; i++) {
        t[i] = true;
        cin >> c[i];
        c_sum += c[i];
    }
    sort(c, c + n);
    
    idx = n - 1;
    dfs(0);
    
    cout << c_sum - c[n - 1] << endl;
    for (int i = 0; i < n; i++) {
        if (i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;
    
}


Measured memory_bytes: 1536
#pragma warning disable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using System.Collections;
using static System.Math;
using static System.Console;

class E { static void Main() => new J(); }
class J
{
	int F() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = G();
		int A = I[0], B = I[1], C = I[2];
		for (var k = 1; k <= B; k++) if (k * A % B == C) { WriteLine("YES"); return; }
		WriteLine("NO");
	}
	long GCD(long a, long b)
	{
		var n = (ulong)Abs(a); var m = (ulong)Abs(b);
		if (n == 0) return (long)m; if (m == 0) return (long)n;
		int zm = 0, zn = 0;
		while ((n & 1) == 0) { n >>= 1; zn++; }
		while ((m & 1) == 0) { m >>= 1; zm++; }
		while (m != n)
		{
			if (m > n) { m -= n; while ((m & 1) == 0) m >>= 1; }
			else { n -= m; while ((n & 1) == 0) n >>= 1; }
		}
		return (long)n << Min(zm, zn);
	}
}

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

using namespace std;
#define ll long long

const int N=1e6+100;

int a[N];
bool solve(int a,int b,int c)
{
    if(a<b) swap(a,b);
    if(a<c) swap(a,c);
    if(b<c) swap(b,c);
    if(b+c>a && a-b<c)   return true;
    return false;
}
int main()
{
    ios::sync_with_stdio(0);
    int n;cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            for(int r=j+1;r<=n;r++){
                    if(a[i]==a[j] || a[i]==a[r] || a[j]==a[r]) continue;
                 ans+=solve(a[i],a[j],a[r]);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>

using namespace std;

class UnionFind {
    vector<int> par;
    vector<int> sizes;
public:
    UnionFind(int n) : par(n), sizes(n, 1) {
        for (int i = 0; i < n; i++) {
            par[i] = i;
        }
    }
    int find(int x) {
        if (x == par[x]) return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (sizes[x] < sizes[y]) swap(x, y);
        par[y] = x;
        sizes[x] += sizes[y];
    }
    bool same(int x, int y) {
        return find(x) == find(y);
    }
};

void solve(long long N, long long M, vector<long long> a, vector<long long> x, vector<long long> y){
    UnionFind u = UnionFind(N);
    for (int i = 0; i < M; i++) {
        u.unite(x[i], y[i]);
    }
    int c = 0;
    vector< vector<int> > trees;
    vector<int> treenum(N, -1);
    int inum;
    for (int i = 0; i < N; i++) {
        inum = u.find(i);
        if (treenum[inum] == -1) {
            treenum[inum] = c;
            c++;
            trees.push_back(vector<int>(1, a[i]));
        } else {
            trees[treenum[inum]].push_back(a[i]);
        }
    }
    for (auto&& t : trees) {
        sort(t.begin(), t.end(), greater<int>());
    }
    long long ret = 0;
    if (trees.size() == 1) {
        std::cout << 0 << std::endl;
        return;
    }
    for (auto&& t : trees) {
        ret += t.back();
        t.pop_back();
    }
    vector<int> rest_v;
    rest_v.reserve(N-trees.size());
    for (auto&& t : trees) {
        rest_v.insert(rest_v.end(), t.begin(), t.end());
    }
    sort(rest_v.begin(), rest_v.end(), greater<int>());
    for (int i = 0; i < trees.size() - 2; i++) {
        if (rest_v.empty()) {
            std::cout << "Impossible" << std::endl;
            return;
        }
        ret += rest_v.back();
        rest_v.pop_back();
    }
    std::cout << ret << std::endl;
}

int main(){	
    struct timeval start,end;
    long long span;
    gettimeofday(&start,NULL);

    long long M;
    long long N;
    scanf("%lld",&N);
    vector<long long> a((N-1)-0+1);
    scanf("%lld",&M);
    vector<long long> x(M-1+1);
    vector<long long> y(M-1+1);
    for(int i = 0 ; i <= (N-1)-0 ; i++){
    	scanf("%lld",&a[i]);
    }
    for(int i = 0 ; i <= M-1 ; i++){
    	scanf("%lld",&x[i]);
    	scanf("%lld",&y[i]);
    }
    solve(N, M, a, x, y);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Measured memory_bytes: 9652
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define pb push_back
void orz(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
}
int main()
{
    //orz();
    long long x,ans;
    cin>>x;
    ans=3*x*x;
    cout<<ans;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<N;i++)
int main(){
  int H,W;
  cin>>H>>W;
  int cnt=0;
  rep(i,H){
    rep(j,W){
      char a; cin>>a;
      if(a=='#') cnt++;
    }
  }
  if(cnt == H+W-1) cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int W, H;

	while (1) {
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0) break;
		for (int i = 0; i < H; i++) {
			//top and bottom
			if (i == 0 || i == H - 1) {
				for (int j = 0; j < W; j++)printf("#");
				printf("\n");
			}
			// nakami
			else {
				printf("#");
				for (int j = 0; j < W - 2; j++)printf(".");
				printf("#\n");
			}
		}
		printf("\n");
	}
}


Measured memory_bytes: 2504
#include <iostream>

#define mod 1000000007
using namespace std;
long long a[100010],t[100010],l[100010],r[100010],ans = 1;
int main(){
	int i,n;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> t[i];
	}
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	l[0] = t[0]; r[0] = t[0];
	for(i=1;i<n;i++){
		if(t[i]!=t[i-1]){
			l[i] =  t[i]; r[i] =  t[i];
		}else{
			l[i] = 1; r[i] = t[i];
		}
	}
	l[n-1] = max(l[n-1],a[n-1]); r[n-1] = min(r[n-1],a[n-1]);
	for(i=n-2;i>=0;i--){
		if(a[i]!=a[i+1]){
			l[i] = max(l[i],a[i]); r[i] = min(r[i],a[i]);
		}else{
			l[i] = max(1LL,l[i]); r[i] =  min(r[i],a[i]);
		}
	}
	
	for(i=0;i<n;i++){
		ans = (ans*max(0LL,r[i]-l[i]+1))%mod;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3328
fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(java.util.Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: java.util.Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val c = mutableMapOf<String, Int>()
        var max = 0
        for (i in 0 until N) {
            val s = sc.next()
            c[s] = (c[s] ?: 0) + 1
            if (c[s]!! > max) {
                max = c[s]!!
            }
        }
        val ans = mutableListOf<String>()
        c.forEach {
            if (it.value == max) ans += it.key
        }
        ans.sorted().forEach { pw.println(it) }
    }
}


Measured memory_bytes: 90512
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
char s[105][105];
bool vis;
int main(){
	int a,b,x,y,t,u;
	scanf("%d%d",&a,&b);
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			if(i<=50) s[i][j]='.';
			else s[i][j]='#';
		}
	}
	x=1;
	y=1;
	vis=0;
	if(b%50!=0) t=2*(b/50+1);
	else t=2*(b/50);
	if(a%50!=0) u=2*(a/50+1)+51;
	else u=2*(a/50)+51;
	if(b>1){
		for(int i=1;i<=t;i+=2){
			for(int j=1;j<=99;j+=2){
				s[i][j]='#';
				y++;
				if(y==b){
					vis=1;
					break;
				}
			}
			if(vis==1) break;
		}
	}
	vis=0;
	if(a>1){
		for(int i=52;i<=u;i+=2){
			for(int j=1;j<=99;j+=2){
				s[i][j]='.';
				x++;
				if(x==a){
					vis=1;
					break;
				}
			}
			if(vis==1) break;
		}
	}
	printf("100 100\n");
	for(int i=1;i<=100;i++) printf("%s\n",s[i]+1);
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner stdIn = new Scanner(System.in);
    int N = stdIn.nextInt();
    int J = 0;
    for(int m=1; m<10; m++){
      if((N%m==0)&&(N/m<=9)&&(N/m>=1)){
        J = 1;
      }
    }
    if(J==1){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

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

int main() {
	int n;
	double t,a;
	cin>>n>>t>>a;
	double h[n];
	double min=10000;
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>h[i];
		if(abs(a-(t-h[i]*0.006))<min){
			min=abs(a-(t-h[i]*0.006));
			ans=i;
		}
	}
	cout<<ans+1<<endl;
	return 0;
}

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

int cnt = 0;
void Bubble_sort(int a[], int n){
	for(int i = 0; i < n-1; i++)
		for(int j = 0; j < n-1-i; j++){
			if(a[j] > a[j+1]){
				int t = a[j]; a[j] = a[j+1]; a[j+1] = t;cnt++;
			}
		}
}


int main(){
	int a[101], n;
	cin>>n;
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}
	Bubble_sort(a, n);
	for(int i = 0; i < n; i++)
	{
		if(i)
			cout<<" "<<a[i];
		else
			cout<<a[i];
	}
	cout<<endl<<cnt<<endl;
	return 0;
}




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

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	int a , b;
	cin >> a >> b;
	if(a > 2 * b)cout << a - 2 * b << "\n";
	else cout << 0 << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long inf=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111

	void solve(){

		

		ins(morty);
		int tmp = 0;
		int rick  = 0;
		FOR(i,0,morty.size()){
			if(morty[i] == 'A' or morty[i] == 'C' or morty[i] == 'G' or morty[i] == 'T'){
				tmp++;
			}
			else {
				rick = max(rick , tmp );
				tmp = 0;
			}
		}
		rick = max(tmp,rick);
		out(rick);
		








	}	























int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
using namespace std;
using ll = long long;
int main() {
    int N , count = 0 , ans = 0;
    cin >> N;
    vector <char> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] == 'R'){
            count++;
        }
    }
    for(int i = 0; i < count; i++){
        if(A[i] == 'W'){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <iostream>
#include <queue>
#include <map>
#include <stack>
#include <string>
#include <cstdlib>
#include <algorithm>
#define INT long long
using namespace std;

INT n, x = 1, y = 1;

int main()
{
    cin>>n;
    while( n-- )
    {
        INT a, b, ta, tb;
        cin>>a>>b;
        ta = (x+a-1)/a;
        tb = (y+b-1)/b;
        x = a*max(ta, tb), y = b*max(ta, tb);
    }
    cout<<x+y<<endl;
    return 0;
}


Measured memory_bytes: 256
def read_input():
    n, m = map(int, input().split())

    return n, m

def submit():
    n, m = read_input()
    limit = 10**9 + 7

    if n == m:
        acc = 1

        for i in range(1, n + 1):
            acc *= i
            if acc > limit:
                acc %= limit

        for i in range(1, m + 1):
            acc *= i
            if acc > limit:
                acc %= limit

        print(2*acc%limit)

    else:
        big = max(n, m)
        small = min(n, m)

        if big - small > 1:
            print(0)
        else:
            acc = 1
            for i in range(1, big + 1):
                acc *= i
                if acc > limit:
                    acc %= limit

            for i in range(1, small + 1):
                acc *= i
                if acc > limit:
                    acc %= limit

            print(acc)





if __name__ == '__main__':
    submit()

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

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RREP(i, a, b) for (int i = (int)(a)-1; i >= (int)(b); --i)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, n, 0)
#define ALL(r) (r).begin(), (r).end()

void Main() {
    // todo
    int n; vector<int> x(110, 0);
    long long a = 0, b = 100000000;
    cin >> n; rep(i, n) cin >> x[i];
    REP(p, 1, 100) {
        a = 0;
        rep(i, n) {
            a += pow(x[i]-p, 2);
        }
        b = min(a, b);
    }
    cout << b << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll l_inf=0x3f3f3f3f3f3f3f3f;
const int maxn=1010;
inline int read(){
    int x=0,c=getchar(),f=0;
    for(;c>'9'||c<'0';f=c=='-',c=getchar());
    for(;c>='0'&&c<='9';c=getchar())
    x=(x<<1)+(x<<3)+c-'0';return f?-x:x;
}
inline bool scan_lf(double &num)
{
        char in;double Dec=0.1;
        bool IsN=false,IsD=false;
        in=getchar();
        if(in==EOF) return false;
        while(in!='-'&&in!='.'&&(in<'0'||in>'9'))
                in=getchar();
        if(in=='-'){IsN=true;num=0;}
        else if(in=='.'){IsD=true;num=0;}
        else num=in-'0';
        if(!IsD){
                while(in=getchar(),in>='0'&&in<='9'){
                        num*=10;num+=in-'0';}
        }
        if(in!='.'){
                if(IsN) num=-num;
                return true;
        }else{
                while(in=getchar(),in>='0'&&in<='9'){
                        num+=Dec*(in-'0');Dec*=0.1;
                }
        }
        if(IsN) num=-num;
        return true;
}

int main()
{
	int a[20][22];
		for (int i=0; i<3; i++){
			for (int j=0; j<3; j++) a[i][j] = read();
		}
		
		bool flag = false;
		if (a[0][1]-a[0][0]==a[1][1]-a[1][0] && a[0][1]-a[0][0]==a[2][1]-a[2][0] &&
			a[0][2]-a[0][0]==a[1][2]-a[1][0] && a[0][2]-a[0][0]==a[2][2]-a[2][0] &&
			a[1][0]-a[0][0]==a[1][1]-a[0][1] && a[1][0]-a[0][0]==a[1][2]-a[0][2] &&
			a[2][0]-a[0][0]==a[2][1]-a[0][1] && a[2][0]-a[0][0]==a[2][2]-a[0][2])
			flag = true;
		if (flag)  puts("Yes");
		else  puts("No");
	return 0;
}

Measured memory_bytes: 256
from random import randint
import numpy as np
from numba import njit


@njit(cache=True)
def f(h,w,m,yp,xp,s):
    ypm = yp[:,0].max()
    xpm = xp[:,0].max()
    yps = yp[yp[:,0] == ypm][:,1]
    xps = xp[xp[:,0] == xpm][:,1]
    ans = 0
    for ypsi in yps:
        for xpsi in xps:
            a = yp[ypsi,0]+xp[xpsi,0]
            if (ypsi,xpsi) in s:
                a -= 1
                ans = max(ans,a)
            else:
                return a
    return ans


h,w,m = map(int,input().split())
s = set()
yp = np.zeros((h,2),dtype=np.int)
xp = np.zeros((w,2),dtype=np.int)
yp[:,1] = np.arange(h)
xp[:,1] = np.arange(w)
for i in range(m):
    hi,wi = map(int,input().split())
    s.add((hi-1,wi-1))
    yp[hi-1,0] += 1
    xp[wi-1,0] += 1
ans = f(h,w,m,yp,xp,s)
print(ans)


Measured memory_bytes: 214376
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
const long long MOD = 1000000007;
typedef long long ll;

int n,k,A,B,M,x,y,c;
string s,t;
int a[100005],b[100005];

int main() {
  cin >> A >> B >> M;
  int mina=1e9,minb=1e9;
  rep(i,A) cin >> a[i], chmin(mina,a[i]);
  rep(i,B) cin >> b[i], chmin(minb,b[i]);
  int ans=mina+minb;
  rep(i,M){
    cin >> x >> y >> c; x--,y--;
    chmin(ans,a[x]+b[y]-c);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024