akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

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

const int mod = 1000000007;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll d,n,m;
  while(cin >> d && d){
    cin >> n >> m;
    vector<ll> v(n+1);
    v[0] = 0;
    REP(i,1,n){
      cin >> v[i];
    }
    v[n] = d;
    sort(all(v));
    ll k,ans = 0;
    rep(i,m){
      cin >> k;
      auto it = lower_bound(all(v),k);
      ll disa = abs(k - *it),disb;
      if(k == 0){
        disb = 0;
      }
      else{
        disb = abs(k - *(it - 1));
      }
      ans += min(disa,disb);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>
#include <deque>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
const int inf = 1<<30;
typedef pair<int, int> P;

int main() {
  int n; cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int cnt = 1;
  int ans = 0;
  rep(i, n) {
    if(a[i] == cnt) cnt++;
    else ans++;
  }
  if(ans == n) cout << -1 << endl;
  else cout << ans << endl;

  return 0;
}


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

int64_t fib(int n){
    if(n == 0){
        return 1;
    }
    else if(n == 1){
        return 1;
    }
    else{
        return fib(n-1) + fib(n);
    }
}

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> A(N,1);
    for (int i = 0; i < M;i++){
        int a;
        cin >> a;
        A.at(a-1) = 0;
    }
    if (N == 1){
        cout << 1 << endl;; 
    }
    else{
        vector<int> ans(N);
        ans.at(0) = 1 * A.at(0);
        ans.at(1) = (ans.at(0) + 1) * A.at(1);
        for (int i = 0; i <= N-3;i++){
            int m = (ans.at(i) + ans.at(i+1)) * A.at(i+2);
            ans.at(i+2) = m %1000000007;
        }
        cout << ans.at(N-1) << endl;
    }

    /* 
    通れないとこで区切って場合の数をかけて行く。
    メモリが足りずスタックオーバーフロー
    vector<int> a(M+2);
    a.at(0) = -1;
    a.at(M+1) = N+1;
    for(int i = 0; i < M; i++){
        cin >> a.at(i);
    }

    int64_t ans = 1;
    bool possible = true;
    for (int i = 0; i < M+1 ;i++){
        int n = a.at(i+1) - a.at(i) - 2;
        if (n == -1){
            possible = false;
            break;
        }
        ans = (ans * fib(n)) % 1000000007;
    }
    
    if(possible){
        cout << ans << endl;
    }
    else{
        cout << 0 << endl;
    }
    */
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define pr9(a,b,c,d,e,f,g,h,i) pr1(a)<<pr8(b,c,d,e,f,g,h,i)
#define pr10(a,b,c,d,e,f,g,h,i,j) pr1(a)<<pr9(b,c,d,e,f,g,h,i,j)
#define prArr(a){CERR<<(#a)<<"={";int i=0;for(auto t:(a))CERR<<(i++?", ":"")<<t;CERR<<"}"<<endl;}
#else
#define DEBUG 0
#define pr(...)
#define prArr(a)
#endif
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Double L;
  cin>>L;

  /*
  Int mx = 0;
  for(Int i=1;i<=L;i++)
    for(Int j=1;j<=L;j++)
      for(Int k=1;k<=L;k++){
        if(i + j + k != L) continue;
        Int v = i * j * k;
        if(v > mx) {
          mx = v;
          pr(i, j, k, i * j * k);
        }
      }
  */
  Double a = L / 3;
  Double ans = a * a * a;
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> ac(N, 0);
    vector<int> wa(N, 0);
    for(int i=0; i<M; i++){
        int p;
        string S;
        cin >> p >> S;
        p--;

        if(S=="AC"){
            ac[p]=1;
        }else if(ac[p]==0){
            wa[p]++;
        }
    }

    int ans_ac=0;
    int ans_wa=0;
    for(int i=0; i<N; i++){
        ans_ac+=ac[i];
        if(ac[i]==1){
            ans_wa+=wa[i];
        }
    }
    cout << ans_ac << ' ' << ans_wa << endl;
}

Measured memory_bytes: 1024
using System;
using System.Linq;

namespace Sample101
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToArray();
            int d = line[0] / line[1];
            int r = line[0] % line[1];
            decimal f = (decimal) line[0] / (decimal) line[1];
            Console.WriteLine(d + " " + r + " " + f); 
        }
    }
}


Measured memory_bytes: 16444
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

map<ll,ll> M;

int main(){
  ll N,C=0;cin>>N;
  string S;
  rep(i,N){
    cin >> S;
    if(S[0]=='M'){
      M[0]++;
    }
    if(S[0]=='A'){
      M[1]++;
    }
    if(S[0]=='R'){
      M[2]++;
    }
    if(S[0]=='C'){
      M[3]++;
    }
    if(S[0]=='H'){
      M[4]++;
    }
  }
  for(int i=0;i<=2;i++){
    for(int j=i+1;j<=3;j++){
      for(int k=j+1;k<=4;k++){
        C+=M[i]*M[j]*M[k];
      }
    }
  }
  cout << C << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int m,n,i,j,a[100][100],b[100],c[100];
  scanf("%d %d",&n,&m);
  for(i=0; i<n; i++){
    for(j=0; j<m; j++){
      scanf("%d ",&a[i][j]);
    }   
  }
  for(j=0; j<m; j++){
    scanf("%d",&b[j]);
  }
  for(i=0; i<n; i++){
    c[i]=0;
  }
  for(i=0; i<n; i++){
    for(j=0; j<m; j++){
      c[i]+=(a[i][j]*b[j]);
    }
  }//-----                          
 for(i=0; i<n; i++){
    printf("%d\n",c[i]);
  }
  return 0;
}


Measured memory_bytes: 2148
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
using namespace std;

int main()
{
	bool flag = true;
	vector<int> a(5);
	for(int i=0; i<5; i++)
	{
		cin>>a[i];
	}
	int k;
	cin>>k;

	if(a[4]-a[0]>k)
	{
		flag = false;
	}
	
	if(flag)
	{
		cout<<"Yay!"<<endl;
	}
	else
	{
		cout<<":("<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int a[222222];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	int ptr=1;
	int cnt=0;
	for(int i=0;i<n;i++)
		if(a[i]==ptr){
			cnt++;
			ptr++;
		}
	if(cnt==0)
		cout<<-1<<endl;
	else
		cout<<n-cnt<<endl;
	return 0;
}

Measured memory_bytes: 4372
#pragma GCC optimize("O2") 
#include <bits/stdc++.h>
using namespace std;

#define dbg(x) cerr << #x"=" << x << endl;
typedef long long LL;
typedef pair<LL, LL> P;
int n;
const int MAX_N = 2*1e5+100;
P a[MAX_N];

int main(){
	//freopen("in.txt","r",stdin);    
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> a[i].second >> a[i].first;
	}
	sort(a, a+n);
	LL now = 0;
	for(int i = 0; i < n; ++i){
		now += a[i].second;
		if(now > a[i].first) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
        int x,y;
        x = sc.nextInt();
        y = sc.nextInt();
        
        if(x<y){
            System.out.println("a < b");
        }
        else if(x>y){
            System.out.println("a > b");
        }
        else{
            System.out.println("a == b");
        }
        
        sc.close();

	}

}


Measured memory_bytes: 26144
#include<iostream>
using namespace std;
int main() {
	char c1[3], c2[3];
	cin >> c1 >> c2;
	if ((c1[0] == c2[2])&&(c1[1] == c2[1])&&(c1[2] == c2[0])) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}


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

using namespace std;

typedef long long ll;
#define fo(i,n) for(int i=0;i<n;i++)

ll a,b,x,n,ans;

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

    cout<<3*(n-__gcd(n,x));
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <tuple>

using namespace std;

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define cina(s, n, a) for(int i = s; i < n; i++) cin >> a[i]
#define couta(n, a) for(int i = 0; i < n; i++) cout << a[i] << ' '
#define copy(s, n, a, b) for(int i = s; i < n; i++) b[i] = a[i]
#define yesno(ok) cout << (ok ? "YES" : "NO")
#define mod(a, b) (b + (a % b)) % b
#define MOD  (ll)1e9 + 7

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

int cnt[10][10];

void solve(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        string s = to_string(i);
        int x = s[0] - '0';
        int y = s[s.size() - 1] - '0';
        cnt[x][y]++;
    }
    
    ll ans = 0;
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            ans += cnt[i][j] * 1ll * cnt[j][i];
        }
    }
    cout << ans;
}

int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for(int i = 1; i <= q; i++){
        solve();
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main() {
	int n, m; cin >> n >> m;
	long long ans = 0LL;
	vector<int>a(n), card;
	vector<pair<int, int> >bc(m);
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < m; i++)cin >> bc[i].second >> bc[i].first;
	sort(a.begin(), a.end());
	sort(bc.begin(), bc.end());
	reverse(bc.begin(), bc.end());
	int cnt = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < bc[i].second; j++) {
			cnt++;
			card.push_back(bc[i].first);
			if (cnt == n)break;
		}
		if (cnt == n)break;
	}
	for (int i = 0; i < card.size(); i++) {
		if (a[i] < card[i]) {
			a[i] = card[i];
		}
	}
	for (int i = 0; i < n; i++) {
		ans += a[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 2044
twod_array = []
twod_array << gets.chomp.split(' ').map(&:to_i)
twod_array << gets.chomp.split(' ').map(&:to_i)
twod_array << gets.chomp.split(' ').map(&:to_i)

sa1 = (twod_array[0][0] - twod_array[0][1]).abs
sa2 = (twod_array[0][0] - twod_array[0][2]).abs

result = 'Yes'

result = 'No' if ((twod_array[1][0] - twod_array[1][1]).abs != sa1 || (twod_array[1][0] - twod_array[1][2]).abs != sa2)
result = 'No' if ((twod_array[2][0] - twod_array[2][1]).abs != sa1 || (twod_array[2][0] - twod_array[2][2]).abs != sa2)

puts result


Measured memory_bytes: 1788
x[100],y[100];i,j,k;
double p[101],s,P=2*acos(-1);
c(a,b)double*a,*b;{return*a<*b?-1:*a>*b;}
main(n){
	for(scanf("%d",&n);~scanf("%d%d",x+j++,y+j););
	for(;i<n;i++)
	{
		for(k=j=0;j<n;j++)i-j&&(p[k++]=atan2(y[j]-y[i],x[j]-x[i]));
		qsort(p,k,8,c);
		for(p[k]=p[j=s=0]+P;++j<n;)s=fmax(s,(p[j]-p[j-1])/P-.5);
		printf("%.9f\n",s);
	}
}


Measured memory_bytes: 384
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    var a = sc.nextInt()
    var b = sc.nextInt()
    var c = sc.nextInt()
    var ans = 0
    val dic = arrayListOf<List<Int>>()
    var flg = false

    while (true) {
        val abc = listOf(a, b, c).sorted()
        if (abc in dic) {
            ans = -1
        }
        for (v in abc) {
            if (v % 2 != 0) {
                flg = true
            }
        }
        if (flg || ans < 0) {
            break
        }
        ans++
        dic.add(abc)
        val x = b / 2 + c / 2
        val y = c / 2 + a / 2
        val z = a / 2 + b / 2
        a = x
        b = y
        c = z
    }
    println(ans)
}


Measured memory_bytes: 36036
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;


int main()
{ 
  ll n,k;
  cin>>n>>k;
  vector<ll > v;
  vector<ll > roads[n];
  for(int i=0;i<n;i++)
  {    ll x;
        cin>>x;
        v.push_back(x);
  }
  for(int i=0;i<k;i++)
  {
    ll a,b;
    cin>>a>>b;
    a--;
    b--;
    roads[a].push_back(b);
      roads[b].push_back(a);
  }
  ll ans=0;
  for(int i=0;i<n;i++)
  {
     if(roads[i].size())
     { int check=1;
        for(int j=0;j<roads[i].size();j++)
        {
           if(v[i]<=v[roads[i][j]])
           {
               check=0;
               break;
           }
        }
        if(check)
         ans++;
     }
    else
    {
        ans++;
    }
  }

  cout<<ans;
return 0;
}


Measured memory_bytes: 9752
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path; ll pre = 0;
int main() {
	cin >> N;
	vl A(N);
	for (i = 0; i < N; i++) cin >> A[i];
	vl L, R;
	for (i = 0; i < N; i++) {
		if (i % 2 == 0) R.push_back(A[i]);
		else L.push_back(A[i]);
	}
	if (N % 2 == 0) {
		reverse(L.begin(), L.end());
		for (i = 0; i < L.size(); i++) {
			cout << L[i] << " ";
		}
		for (i = 0; i < R.size(); i++) {
			cout << R[i] << " ";
		}
	}
	else {
		reverse(R.begin(), R.end());
		for (i = 0; i < R.size(); i++) {
			cout << R[i] << " ";
		}
		for (i = 0; i < L.size(); i++) {
			cout << L[i] << " ";
		}
	}
}

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

int main(){
    char s[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++) cin>>s[i][j];
    }
    cout<<s[0][0]<<s[1][1]<<s[2][2]<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long int
#define deb(x) cout << #x << " = " << x << endl
#define deb2(x, y) cout << #x << " = " << x << " , " << #y << " = " << y << endl

  
void test()
{
    
       int n;
       cin>>n;
       if(n)
        cout<<"0"<<endl;
       else
        cout<<"1"<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        test();
    }
    return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String A;
		String B;
		int i;
		A = sc.nextLine();
		B = sc.nextLine();
		int[] Anum = new int[A.length()];
		int[] Bnum = new int[B.length()];

		if (Anum.length > Bnum.length) {
			System.out.println("GREATER");
		} else if (Anum.length < Bnum.length) {
			System.out.println("LESS");
		} else {
			for (i = 0; i < A.length(); i++)
				Anum[i] = Character.getNumericValue(A.charAt(i));
			for (i = 0; i < B.length(); i++)
				Bnum[i] = Character.getNumericValue(B.charAt(i));

			for (i = 0; i < A.length(); i++) {
				if (Anum[i] < Bnum[i]) {
					System.out.println("LESS");
					break;
				} else if (Anum[i] > Bnum[i]) {
					System.out.println("GREATER");
					break;
				} else if (i == A.length() - 1 && Anum[i] == Bnum[i])
					System.out.println("EQUAL");
			}

		}
	}

}

Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 
    int n, x, y;
    cin >> n >> x >> y; 
    int distance[n]={0};
 
    for(int i=1; i<=n-1; i++){
        int count=0;
        for(int j=i+1; j<=n; j++){
            int dist = min(abs(j-i),abs(x-i)+abs(y-j)+1);
            dist=min(dist, abs(y-i)+abs(x-j)+1);
            distance[dist]++;
        }
    }
    for(int i=1; i<n; i++) cout << distance[i] << "\n";
    return 0;
}

Measured memory_bytes: 256
import math

num_0 = list()
for ii in range(5):
    num_0.append(int(input()))

num_1 = list(range(5))
for ii in range(5):
    num_1[ii] = 10 * math.ceil(num_0[ii]/10)
   
num_2 = list(range(5))
for ii in range(5):
    num_2[ii] = num_1[ii] - num_0[ii]
    
num = max(num_2)
    
print(sum(num_1) - num)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
int main() {
    int a[10];
    for(int i=0;i<10;i++){
        cin >> a[i];
    }
    for (int i=0; i<10; i++) {
        for(int j=9;j>i;j--){
            if(a[j]>a[j-1]){
                swap(a[j], a[j-1]);
            }
        }
    }
    cout << a[0] <<endl<< a[1]<< endl<<a[2] <<endl;
    return 0;
}



Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=100005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	return Div(F[n],F[n-k]*F[k]%mod);
}

int n;
vl a,b;

int main(){
	cin>>n;
	a=b=vl(n);
	ll lx=INF,rx=-INF,ly=INF,ry=-INF;
	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		a[i]=x+y;
		b[i]=x-y;
		lx=min(lx,a[i]);
		rx=max(rx,a[i]);
		ly=min(ly,b[i]);
		ry=max(ry,b[i]);
	}
	ll res=0;
	for(int i=0;i<n;i++){
		res=max({res,rx-a[i],a[i]-lx,ry-b[i],b[i]-ly});
	}
	cout<<res<<endl;
}

Measured memory_bytes: 6340
alphabet = "abcdefghijklmnopqrstuvwxyz"
S = raw_input()
if len(S) < 26:
  for ab in alphabet:
    if not ab in S:
      print S+ab
      break
else:
  i = -1
  s = "Z"
  while i > -27 and s < S[i]:
    s = S[i]
    i -= 1
  if i == -27:
    print "-1"
  else:
    for ab in alphabet[alphabet.index(S[i])+1:]:
      if not ab in S[:i]:
        print S[:i]+ab
        break



Measured memory_bytes: 2568
#include <atcoder/all>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define LL long 

int n,m;

int main(){
    cin>>n>>m;
    auto g = atcoder::scc_graph(n);
    REP(i,m){
        int a,b;
        cin>>a>>b;
        g.add_edge(a,b);
    }
    auto scc = g.scc();
    cout<<scc.size()<<endl;
    REP(i,scc.size()){
        cout<<scc[i].size()<<" ";
        REP(j,scc[i].size()){
            cout<<scc[i][j]<<" ";
        }
        cout<<endl;
    }
}

Measured memory_bytes: 40604
import sys

n, m = map(int, input().split())
a = list(map(int, sys.stdin.readline().split()))
bc = [ tuple(map(int, x.split())) for x in sys.stdin.readlines()]
bc.sort(key = lambda x:x[1], reverse=True)
bc.append((n,0))
diff = []
for b, c in bc:
    diff += [c] * b
    if len(diff) > n:
        break

a += diff
a.sort()
print(sum(a[-n:]))


Measured memory_bytes: 28384
#include<bits/stdc++.h>
using namespace std;
inline int read () {
	int num = 0;
	char c = ' ';
	bool flag = true;
	for (;c > '9' || c < '0';c = getchar())
		if (c == '-')
			flag = false;
	for (;c >= '0' && c <= '9';num = (num << 1) + (num << 3) + c - 48, c = getchar());
	return flag ? num : -num;
}
namespace INIT {
	const int maxn = 200200;
	int n, a[maxn];
	void init () {
		n = read ();
		for (int i = 1;i <= n;i ++)
			a[i] = read ();
	}
} using namespace INIT;
struct node {
	int num,val;
} c1[maxn],c2[maxn];
int map1[maxn],cnt1 = 0;
bool mycmp (node a,node b) {
	return a.val >= b.val;
}
void work1 () {
	for (int i = 1;i <= n;i += 2) {
		if (map1[a[i]] == 0) {
			map1[a[i]] = ++ cnt1;
			c1[cnt1].num = a[i];
		}
		c1[map1[a[i]]].val ++;
	}
}

int map2[maxn],cnt2 = 0;
void work2 () {
	for (int i = 2;i <= n;i += 2) {
		if (map2[a[i]] == 0) {
			map2[a[i]] = ++ cnt2;
			c2[cnt2].num = a[i];
		}
		c2[map2[a[i]]].val ++;
	}
}
node a1,a2,b1,b2;
void SORT () {
	for (int i = 1;i <= cnt1;i ++) {
		if (c1[i].val > a1.val) {
			a2 = a1;
			a1 = c1[i];
		}
		else if (c1[i].val > a2.val) {
			a2 = c1[i];
		}
	}
	for (int i = 1;i <= cnt2;i ++) {
		if (c2[i].val > b1.val) {
			b2 = b1;
			b1 = c2[i];
		}
		else if (c2[i].val > b2.val) {
			b2 = c2[i];
		}
	}
}
void work () {
	int ans = 0x7fffffff,now;
	if (a1.num != b1.num) {
		now = n - a1.val - b1.val;
		ans = min (ans,now);
	}
	if (a1.num != b2.num) {
		now = n - a1.val - b2.val;
		ans = min (ans,now);
	}
	if (a2.num != b1.num) {
		now = n - a2.val - b1.val;
		ans = min (ans,now);
	}
	if (a2.num != b2.num) {
		now = n - a2.val - b2.val;
		ans = min (ans,now);
	}
	cout << ans << endl;
}
int main () {
	//freopen ("1.in","r",stdin);
	//freopen ("1.out","w",stdout);
	//int st = clock (),en;
	init ();
	//en = clock ();
	//printf ("\nÓÃÊ± %d ms\n",en - st); 
	work1 ();
	//en = clock ();
	//printf ("\nÓÃÊ± %d ms\n",en - st); 
	work2 ();
	//en = clock ();
	//printf ("\nÓÃÊ± %d ms\n",en - st); 
	SORT ();
	//en = clock ();
	//printf ("\nÓÃÊ± %d ms\n",en - st); 
	work ();
	//en = clock ();
	//printf ("\nÓÃÊ± %d ms\n",en - st); 
	return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, Y, Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << endl;
}

Measured memory_bytes: 892
def get_primenumber(N):
    #素数リスト
    prime_list = [2]
    #3からNまでの数字を一つずつ取り出す
    for num in range(3,N+1,2):
        #取り出した数字が素数リストの要素で割れなければ素数リストに追加する
        if all( num % prime != 0 for prime in prime_list):
            prime_list.append(num)


    return prime_list

def main():
    while True:
      number = int(input())
      if number > 1:
        break
      else:
        print("2以上の自然数を入力してください")
    nums = get_primenumber(10000)
    count = 0
    for i in range(10000):
        if nums[i] % 5 == 1:
            print(nums[i], end=' ')
            count += 1
        if count == number:
            break



if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include<stdio.h>
#include<string.h>
int main() {
	long long int n, s[5000] = {}, m, min = 100, max = 0, count = 0, x,memo,memo2;
	char str[3000], str2[3000];
	scanf("%s%s", str, str2);
next:
	min = 100, max = -1;
	for (int i = 0; i < strlen(str2); i++) {
		if (str2[i] == 'Z') { continue; }
		if (max < str2[i] - 'a') { max = str2[i] - 'a'; memo2 = i; }
	}

	for (int i = 0; i < strlen(str); i++) {
		if (str[i] == 'Z') { continue; }
		if (min > str[i] - 'a') { min = str[i] - 'a'; memo = i; }
	}
	if (max == -1) {
		printf("No"); return 0;
	}
	if (min == 100) {
		printf("Yes"); return 0;
	}
	if (max == min) { str2[memo2] = 'Z'; str[memo] = 'Z';goto next; }
	
	if (max > min) { printf("Yes"); }
	else { printf("No"); }
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n=I()
ps=LI()
count=0
for i in range(n):
    if ps[i]!=i+1:
        count+=1
if count<=2:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, ma, mb;
  cin >> N >> ma >> mb;
  ll fn = (N + 1) / 2, bn = N - fn;
  vector<vector<ll>> front;
  vector<vector<ll>> back;
  unordered_map<ll, ll> fm;
  unordered_map<ll, ll> bm;
  for (ll i = 0; i < N; ++i) {
    ll a, b, c;
    cin >> a >> b >> c;
    if (i < fn) {
      front.push_back({a, b, c});
    }
    else {
      back.push_back({a, b, c});
    }
  }
  for (ll i = 1; i < (1 << fn); ++i) {
    ll a = 0, b = 0, c = 0;
    for (ll j = 0; j < fn; ++j) {
      if ((i & (1 << j)) != 0) {
        vector<ll> temp = front.at(j);
        a += temp.at(0);
        b += temp.at(1);
        c += temp.at(2);
      }
    }
    ll num = mb * a - ma * b;
    auto itr = fm.find(num);
    if (itr == fm.end()) {
      fm[num] = c;
    }
    else {
      fm[num] = min(fm[num], c);
    }
  }
  for (ll i = 1; i < (1 << bn); ++i) {
    ll a = 0, b = 0, c = 0;
    for (ll j = 0; j < bn; ++j) {
      if ((i & (1 << j)) != 0) {
        vector<ll> temp = back.at(j);
        a += temp.at(0);
        b += temp.at(1);
        c += temp.at(2);
      }
    }
    ll num = ma * b - mb * a;
    auto itr = bm.find(num);
    if (itr == bm.end()) {
      bm[num] = c;
    }
    else {
      bm[num] = min(bm[num], c);
    }
  }
  ll ans = INF;
  auto itr = fm.find(0);
  if (itr != fm.end()) {
    ans = min(ans, itr->second);
  }
  auto itr2 = bm.find(0);
  if (itr2 != bm.end()) {
    ans = min(ans, itr2->second);
  }
  for (auto itr = fm.begin(); itr != fm.end(); ++itr) {
    auto temp_itr = bm.find(itr->first);
    if (temp_itr != bm.end()) {
      ans = min(ans, itr->second + temp_itr->second);
    }
  }
  if (ans == INF) {
    cout << -1 << "\n";
  }
  else {
    cout << ans << "\n";
  }
}


Measured memory_bytes: 3724
N,M=map(int,input().split())
E=0
i=1
a=(1900*(M)+100*(N-M))*(0.5)**(M)
while a>10e-10:
    a=(1900*(M*i)+100*(N-M)*i)*(((2**M-1)*(0.5)**M)**(i-1))*(0.5)**M
    E+=a
    i+=1
print(int(E)+1)




Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.*;
public class Main{
	static int n;
	static int k;
	static int[] arr;
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.valueOf(br.readLine());
		int rem=n%1000;
		if(rem!=0)
			rem=1000-rem;
		System.out.println(rem);
	}

}


Measured memory_bytes: 32528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
vector<string> split(string s, char p){vector<string>v;stringstream m(s);string b;while(getline(m,b,p))v.push_back(b);return v;}
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 (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main(){
    ll N; cin >> N;
    while(N > 1000) {
        N -= 1000;
    }
    N = 1000 - N;
    cout << N << "\n";
}


Measured memory_bytes: 3656
# -*- coding: utf-8 -*-

N, Y = map(int, input().split())

ans = 0
for n10K in range(N + 1):
    for n5K in range(N + 1 - n10K):
        if Y - n10K * 10000 - n5K * 5000 == (N - n10K - n5K) * 1000:
            print("{} {} {}".format(n10K, n5K, N - n10K - n5K))
            exit()

print("-1 -1 -1")


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

using namespace std;

long re;
pair<int, int> a[111111];
int b[111111];
struct UFNode
{
	UFNode *parent;
	int rank;
	pair<int, int> i;
	UFNode() :parent(nullptr), rank(0) {}
	UFNode &Find() {
		if (parent == nullptr)
			return *this;
		return *(parent = &parent->Find());
	}
	int Union(UFNode &n) {
		auto &r = Find(), &nr = n.Find();
		if (&r == &nr) return 0;
		if (r.rank < nr.rank) {
			r.parent = &nr;
			if (nr.i <= r.i)
				re -= b[r.i.second] = r.i.first;
			else re -= b[nr.i.second] = nr.i.first, nr.i = r.i;
		}
		else {
			nr.parent = &r, r.rank += r.rank == nr.rank;
			if (r.i <= nr.i)
				re -= b[nr.i.second] = nr.i.first;
			else re -= b[r.i.second] = r.i.first, r.i = nr.i;
		}
		return -1;
	}
} u[111111];

int main()
{
	int n, m, k;
	cin >> n >> m;
	k = n;
	fill(b, b + n, 2e9);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i].first), a[i].second = i, re += a[i].first, u[i].i = a[i];
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		k += u[x].Union(u[y]);
	}
	if (k == 1) {
		cout << 0 << endl;
		return 0;
	}
	if (n - k < k - 2) {
		cout << "Impossible" << endl;
		return 0;
	}
	sort(b, b + n);
	for (int i = 0; i < k - 2; i++)
		re += b[i];
	cout << re << endl;
	return 0;
}


Measured memory_bytes: 3968
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
//#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define all(x) (x).begin(),(x).end()
#define matrix vector<vector<ll>>
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end());
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; ++i){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL));
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000 * 1000 * 1000;
const ld PI = acos(-1.0);
const ll mod1 = inf + 7;
const ll mod2 = inf + 9;
const int MAXN = 500001;
const ld EPS = 1e-9;
int hp = 179;

signed main()
{
	int a, b, x;
	cin >> a >> b >> x;
	if (x < a)
	{
		cout << "NO";
		return 0;
	}
	if (x < a + b)
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}
}	

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

int main()
{

	// #ifndef ONLINE_JUDGE

	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// freopen("error.txt","w",stderr);

	// #endif

	int n; cin>>n;
	int flag=0;
	for (int i = 1; i*i <= n; ++i)
	{
		if(n%i==0)
		{
			if(i<=9 and n/i<=9) flag=1;
		}
	}
	if(flag) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
coins = int(input())
happiness = 0


def happiness_point(remainder, num, point, all_point):
    result = divmod(remainder, num)
    all_point += result[0] * point
    remainder = result[1]
    return remainder, all_point


if coins / 500 >= 1:
    coins, happiness = happiness_point(coins, 500, 1000, happiness)

if coins / 5 >= 1:
    coins, happiness = happiness_point(coins, 5, 5, happiness)

print(happiness)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

  vector<pair<ll, ll>> robot(n);
  for (int i = 0; i < n; i++) {
    cin >> robot[i].first >> robot[i].second;
  }

  sort(robot.begin(), robot.end());

  ll before_limit = - 1e10;
  int ans = 0;

  for (int i = 0; i < n; i++) {
    if (before_limit <= robot[i].first - robot[i].second) {
      ans++;
      before_limit = robot[i].first + robot[i].second;
    }
    else {
      if (robot[i].first + robot[i].second < before_limit) {
        before_limit = robot[i].first + robot[i].second;
      }
    }
  }

cout << ans << endl;

return 0;
}

Measured memory_bytes: 1792
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]
M = lines[0][1]
C = lines[0][2]

ans = 0
for i in 1..N do
  score = 0
  for j in 1..M do
    score += lines[i+1][j-1] * lines[1][j-1]
  end
  if score + C > 0 then
    ans += 1
  end
end
puts ans

Measured memory_bytes: 14380
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

struct UnionFind {
    vector<int> par;
    int n, cnt;
    UnionFind(const int& x = 0) {init(x);}
    void init(const int& x) {par.assign(cnt=n=x, -1);}
    inline int find(const int& x) {return par[x] < 0 ? x : par[x] = find(par[x]);}
    inline bool same(const int& x, const int& y) {return find(x) == find(y);}
    inline bool unite(int x, int y) {
        if ((x = find(x)) == (y = find(y))) return false;
        --cnt;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    inline int count() const {return cnt;}
    inline int count(int x) {return -par[find(x)];}
};

int main() {
	int N, M;
	cin >> N >> M;
	UnionFind uf(N+M);
	for (int i = 0; i < N; i++) {
		int K;
		cin >> K;
		for (int j = 0; j < K; j++) {
			int L;
			cin >> L;
			--L;
			uf.unite(i, N+L);
		}
	}
	for (int i = 1; i < N; i++) {
		if (!uf.same(0, i)) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h> 
using namespace std;
int main(void){
    // Your code here!
   int N,M;
   cin >> N >> M;
   vector<int> vec(N);
   vec.at(0) = -1;
   for(int i = 1; i < N; i++)vec.at(i) = 1;
   
   for(int i = 0; i < M; i++){
       int x,y;
       cin >> x >> y;
       x--;
       y--;
       if(vec.at(x) > 0){
           if(vec.at(y) >= 0){
               vec.at(x)--;
               vec.at(y)++;
           }
           else{
               vec.at(x)--;
               vec.at(y)--;
           }
       }
       
       else{
           if(vec.at(y) >= 0){
               vec.at(x)++;
               vec.at(y) = (vec.at(y) + 1) * (-1);
           }
           else{
               vec.at(x)++;
               vec.at(y)--;
           }
           
       }
   }
   int count = 0;
   for(int i = 0; i < N; i++){
       if(vec.at(i) < 0) count++;
   }
   cout << count << endl;
   
   
}



Measured memory_bytes: 640
// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("Ofast")
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, n) for (i64 i = 0; i < (i64)(n); ++i)
#define reps(i, s, n) for (i64 i = s; i < (i64)(n); ++i)

void solve() {
    int n, q;
    cin >> n >> q;
    atcoder::dsu d(n);

    int t, u, v;
    while (q--) {
        cin >> t >> u >> v;
        if (t == 0) {
            d.merge(u, v);
        } else {
            if (d.same(u, v)) {
                cout << "1\n";
            } else {
                cout << "0\n";
            }
        }
    }
}
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 3836
N, W = map(int, input().split())
dp = [10000000001] * (10**3 * N + 1)
dp[0] = 0

for i in range(N):
    w, v = map(int, input().split())
    for j in range(len(dp)-1, v-1, -1):
        if dp[j-v] + w <= W:
            dp[j] = min(dp[j-v] + w, dp[j])

for j in range(len(dp)-1, v-1, -1):
    if dp[j] <= W:
        ans = j
        break

print(ans)


Measured memory_bytes: 41836
#include <bits/stdc++.h>
using namespace std;
#define int long long

int mod_pow(int n, int e, int mod){
    int ans = 1;
    n = n % mod;
    while(e != 0){
        if(e % 2 == 1){
            ans = (ans * n) % mod;
        }
        e /= 2;
        n = (n * n) % mod;
    }
    return ans;
}

int my_gcd(int n, int m){
    if(n < 0) n*=-1;
    if(m < 0) m*=-1;
    if(n < m) swap(n, m);
    if(m == 0) return n;
    else return my_gcd(m, n%m);
}

signed main(){
    // cout << fixed << setprecision(10) << flush;

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

    map<pair<int, int>, int> mp;
    int aho = 0;
    for(int i=0; i<n; i++){
        if(a[i] != 0 && b[i] == 0){
            if(mp.find(make_pair(1,0)) != mp.end()){
                mp[make_pair(1,0)]++;
            }
            else mp[make_pair(1,0)] = 1;
        }
        else if(a[i] == 0 && b[i] != 0){
            if(mp.find(make_pair(0,1)) != mp.end()){
                mp[make_pair(0,1)]++;
            }
            else mp[make_pair(0,1)] = 1;
        }
        else if(a[i] == 0 && b[i] == 0){
            aho++;
        }
        else{
            int g = my_gcd(a[i], b[i]);
            if(a[i] < 0){
                a[i] *= -1;
                b[i] *= -1;
            }
            pair<int, int> p = make_pair(a[i]/g, b[i]/g);
            if(mp.find(p) != mp.end()) mp[p]++;
            else mp[p] = 1;
        }
    }

    int ans = 1;
    int mod = 1000000007;
    for(auto itr=mp.begin(); itr != mp.end(); itr++){
        pair<int, int> right;
        if(itr->first.second == 0){
            right = make_pair(0, 1);
        }
        if(itr->first.first == 0){
            right = make_pair(1, 0);
        }
        else if(itr->first.second > 0){
            right = make_pair(itr->first.second, itr->first.first * -1);
        }
        else{
            right = make_pair(itr->first.second * (-1), itr->first.first);
        }
        int m = 0;
        if(mp.find(right) != mp.end()){
            m = mp[right];
        }
        ans = (ans * ((mod_pow(2, itr->second, mod) + mod_pow(2, m, mod) + mod - 1) % mod))%mod;
        if(m != 0) mp[right] = 0;
        itr->second = 0;
    }
    cout << (ans - 1 + aho + mod) % mod << endl;

    return 0;
}

Measured memory_bytes: 18696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1e9+7;

int main(){
  int n;cin>>n;
  int a[n];rep(i,n)cin>>a[i];
  int c[n]={};
  rep(x,n){
    int i=n-x;
    int ctr=0;
    rep(j,2,2*100001){
      if(i*j>n)break;
      if(c[i*j-1])ctr++;
    }
    c[i-1]=a[i-1]^(ctr%2);
  }
  vector<int> ans;
  rep(i,n){
    if(c[i])ans.push_back(i+1);
  }
  cout<<(int)ans.size()<<endl;
  rep(i,ans.size())cout<<ans[i]<<endl;
}

Measured memory_bytes: 3064
let cons x xs = x :: xs

let rec foldn f a = function
  | 0 -> a
  | n -> foldn f (f a) (n - 1)

let () =
  let h, w = Scanf.scanf "%d %d\n" (fun h w -> h, w) in
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let as_ = Array.init n (fun i -> Scanf.scanf "%d " (fun a -> (i + 1, a))) in
  Array.fold_left (fun (acc, current, current_sum) (i, a) ->
    let s = string_of_int i in
    if w <= current_sum + a then
      foldn (cons (foldn (cons s) [] w))
        (foldn (cons s) current (w - current_sum) :: acc)
        ((current_sum + a) / w - 1), foldn (cons s) [] ((current_sum + a - w) mod w), (current_sum + a - w) mod w
    else (acc, foldn (cons s) current a, a + current_sum)) ([], [], 0) as_
  |> (fun (acc, _, _) -> acc)
  |> List.fold_left (fun (acc, b) a -> ((if b then List.rev a else a) :: acc, not b)) ([], true)
  |> fst
  |> List.map (String.concat " ")
  |> List.iter print_endline

Measured memory_bytes: 3328
n=int(input())
s=input()
x=(s.count('R'))*(s.count('G'))*(s.count('B'))
for i in range(1,(n-1)//2+1):
  for j in range(n-i*2):
    if len(set([s[j],s[j+i],s[j+i+i]]))==3:
      x-=1
print(x)

Measured memory_bytes: 68328
def fact(n):
	return 1 if n == 0 else n*fact(n-1)

S = raw_input()
lS,ls = len(S),len(set(list(S)))
d = [S.count(i) for i in set(list(S))]
dd = sum([d[i]%2 for i in range(ls)])
if (lS%2 == 0 and dd != 0 )or (lS%2 == 1 and dd != 1): 
		print 0
else:
	denomi = 1
	for i in range(ls):
		denomi *= fact(d[i]/2)
	print fact(lS/2)/denomi

Measured memory_bytes: 4232