akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

const int INF = 1<<28;
const int MAXV = 202;
int V;
int G[MAXV][MAXV];
string label[MAXV];
bool isGoto[MAXV];

void addEdge(int a, int b, int c) {
  G[a][b] =  min(G[a][b], c);
}

int main() {
  int N;
  cin >> N;
  for(int i = 0; i < N; ++i) {
    string s;
    cin >> s;
    if(s == "goto") {
      isGoto[i] = true;
      cin >> label[i];
    } else {
      isGoto[i] = false;
      label[i] = s;
    }
    label[i].resize(label[i].size()-1);
  }

  V = N+1;
  fill(G[0], G[MAXV], INF);
  for(int i = 0; i < V; ++i) G[i][i] = 0;

  for(int i = 0; i < N; ++i) {
    if(isGoto[i]) {
      for(int j = 0; j < N; ++j) {
        if(!isGoto[j] && label[j] == label[i]) {
          addEdge(i, j, 0);
          break;
        }
      }
      addEdge(i, i+1, 1);
    } else {
      addEdge(i, i+1, 0);
    }
  }

  for(int k = 0; k < V; ++k) {
    for(int i = 0; i < V; ++i) {
      for(int j = 0; j < V; ++j) {
        G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
      }
    }
  }
  cout << G[0][N] << endl;

  return 0;
}

Measured memory_bytes: 1384
#include <stdio.h>

int main(){
  
  int n,m;
  scanf("%d %d", &n, &m);
  
  int result_n, result_m;
  
  for(int i=m-1; i > 0; i-- )result_m = result_m + i;
  for(int i=n-1; i > 0; i-- )result_n = result_n + i;
  
  printf("%d", result_m + result_n);
  
  return 0;
}


Measured memory_bytes: 128
/*
	0106:Discounts of Buckwheat
*/
#include	<iostream>
#include	<cstdio>
#include	<cmath>
#define _INF 20000000

using namespace std;

int main(void) {
	while(1) {
		int minPrise = _INF, target_g;
		
		cin >> target_g;
		if(target_g == 0) { break; }
		for(int a = 0; a < 26; a++) {
			for(int b = 0; b < 17; b++) {
				for(int c = 0; c < 11; c++) {
					int buf = 0;
					
					if((200*a) + (300*b) + (500*c) != target_g) { continue; }
					buf += 380*(a-a%5)*0.80+380*(a%5);
					buf += 550*(b-b%4)*0.85+550*(b%4);
					buf += 850*(c-c%3)*0.88+850*(c%3);
					minPrise = min(minPrise, buf);
				}
			}
		}
		cout << minPrise << endl;
	}
	return 0;
}

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

using namespace std;

using ll = long long;

using vi = vector<int>;
using vll = vector<ll>;

using pi = pair<int, int>;
using pll = pair<ll, ll>;

constexpr auto MOD = 1e9 + 7;
constexpr auto INF = 0x3f3f3f3f;

#define rep(i, a, b) for (auto i = a; i < b; ++i)

template <class T> inline T square(T x) { return x * x; };

template <class T> void print(const T &val) { cout << val << '\n'; }

template <class Iterator> void print(Iterator begin, Iterator end) {
  for (auto it = begin; it != end; ++it) {
    cout << *it << ' ';
  }

  cout << '\n';
}

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

  int n, k;
  cin >> n >> k;

  vi a(n + 1);
  for (auto i = 1; i <= n; ++i) {
    cin >> a[i];
  }

  vi dp(n + 1, INF);
  dp[1] = 0;
  /* dp[2] = abs(a[1] - a[2]); */

  for (auto i = 2; i <= n; ++i) {
    for (auto j = 1; j <= k; ++j) {
      if (i - j < 1) {
        break;
      }

      dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));
    }
  }


  print(dp[n]);
}


Measured memory_bytes: 1152
#pragma optimize("unroll-loops,no-stack-protector")
#include <bits/stdc++.h>
using namespace std;
// using namespace __gnu_pbds;
// #include <ext/pb_ds/assoc_container.hpp>
// typedef tree<int,null_type,less<int>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define Max(a,b,c) max(a,max(b,c))
#define Min(a,b,c) min(a,min(b,c))
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define pc(x)  __builtin_popcount (x)
#define vl vector< ll >
#define sorts(v) sort(v.begin(),v.end())
#define sortg(v) sort(v.begin(),v.end(),greater<ll>())
#define ss second
#define ff first
#define ll long long
#define ld long double
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1e18)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod 1000000007
#define mem(x,y) memset(x,y,sizeof(x))
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define gcd __gcd
#define primeDEN 727999983
#define nx_pe next_permutation(s.begin(),s.end())
#define cl cout<<"\n"
#define sp(x) setprecision(x)
const ll N=1e5+5;
vector<ll>v[N];
ll n,m;
ll deg[N];
bool vis[N];
ll dp[N];

void dfs(ll u)
{
    vis[u]=1;
    ll temp=0;
    for(ll x:v[u])
    {
        if(vis[x])
        {
            temp=max(temp,dp[x]);
            continue;
        }
        dfs(x);
        temp=max(temp,dp[x]);
    }
    dp[u]+=temp;
}

void solve()
{
   cin>>n>>m;
   f(i,1,n+1)dp[i]=1;

   rep(i,m)
   {
       ll x,y;
       cin>>x>>y;
       v[x].pb(y);
       deg[y]++;
   }
   f(i,1,n+1)
   {
       if(!vis[i])
       {
           dfs(i);
       }
   }
   ll ans=0;
//    f(i,1,n+1)
//    {
//        cout<<dp[i]<<" ";
//    }
//    cl;
   f(i,1,n+1)ans=max(ans,dp[i]);
   cout<<ans-1<<'\n';

}


    
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("ouput.txt", "w", stdout) ;
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    std::ios::sync_with_stdio(false);
    ll te=1;
    // cin>>te;
    while(te--){
        solve();
    }
    
}


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

using namespace std;
#define ll long long
int main(){
	int n;
	scanf("%d",&n);
	static long long ans1[100001],ans2[100001];
	for(int i=1;i<=n;i++){
		ans1[i] = ans2[i] = 0ll;
	}
	static int p[200001];

	for(int i=0;i<n;i++){
		scanf("%d",&p[i]);
		if(i==0){
			continue;
		} else
		if(p[i]>p[i-1]){
			ans1[p[i]]+=i;
		} else {
			ans2[p[i]]+=i;
		}
	}
	ll sum = 0;
	for(int i=1;i<=n;i++){
		//sum += ans1[i];
		//ans1[i] = sum;
		ans1[i] += ((i-1)*(n+1)+3);
	}
	sum = 0;
	for(int i=n;i>=1;i--){
		//sum += ans2[i];
		//ans2[i] = sum;
		ans2[i] += ((n-i)*(n+1)+2);
	}
	
	for(int i=0;i<n;i++){
		printf("%lld ",ans1[i+1]);
	}
	puts("");
	for(int j=0;j<n;j++){
		printf("%lld ",ans2[j+1]);
	}
	puts("");
	return 0;	
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

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

struct edge {
    ll cost,from,to;
};
vector<vector<edge> > g(100010);
int main(){
    ll V,E; cin >> V >> E;
    vector<ll> dist(V,INF);
    UnionFind uf(V);
    priority_queue<pair<ll,pair<ll,ll>>, vector<pair<ll,pair<ll,ll>>>, greater<pair<ll,pair<ll,ll>>>> pq;
    for (int i = 0; i < E; i++){
        ll s,t,d; cin >> s >> t >> d;
        pq.push({d,{s,t}});
    }
    ll sum = 0;
    while (pq.size()){
        pair<ll,pair<ll,ll> >  fr = pq.top();
        pq.pop();
        if (!uf.same(fr.second.first, fr.second.second)){
            sum += fr.first;
            uf.unite(fr.second.first, fr.second.second);
        }
    }
    cout << sum << endl;
}


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

void calculate(){
    int N; string s;
    cin >> N >> s;
    int res = 0;
    for(int i = 0;i < N - 2;++i)
        if(s[i] == 'A' and s[i + 1] == 'B' and s[i + 2] == 'C')
            res++;
    cout << res << '\n';
}

int main(int, char**) {
    calculate();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void){
	int a, b, c;
	int rec=0, loze=0;
	
	while(scanf("%d,%d,%d", &b, &c, &a) != EOF){
		if(acos((-a*a + b*b + c*c) / (2.0*b*c)) == (M_PI / 2)){
			rec++;	
		}else if(b == c){
			loze++;
		}
	}
	
	printf("%d\n%d\n", rec, loze);

	return 0;
}

Measured memory_bytes: 0
X = int(input())
if 400 <= X <= 599:
    print("8")
elif 600 <= X <= 799:
    print("7")
elif 800 <= X <= 999:
    print("6")
elif 1000 <= X <= 1199:
    print("5")
elif 1200 <= X <= 1399:
    print("4")
elif 1400 <= X <= 1599:
    print("3")
elif 1600 <= X <= 1799:
    print("2")
elif 1800 <= X <= 1999:
    print("1")

Measured memory_bytes: 9140
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

int main()
{
    int n,m;
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(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 repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define LF "\n"

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

int a,b,q;
ll s[200000], t[200000], x[200000];


int main()
{
	FAST;

	cin >> a >> b >> q;
	
	s[0] = -1ll<<50;
	t[0] = -1ll<<50;
	rep(i,a) cin >> s[i+1];
	rep(i,b) cin >> t[i+1];
	s[a+1] = 1ll<<50;
	t[b+1] = 1ll<<50;
	a += 2;
	b += 2;
	rep(i,q) cin >> x[i];
	rep(i,q){
		ll p = x[i];
		int sid = lower_bound(s,s+a,p) - s;
		int tid = lower_bound(t,t+b,p) - t;
		ll ans = 1ll<<60;
		ans = min(ans, abs(p-s[sid])+abs(s[sid]-t[tid]));
		ans = min(ans, abs(p-t[tid])+abs(t[tid]-s[sid]));
		sid--;
		ans = min(ans, abs(p-s[sid])+abs(s[sid]-t[tid]));
		ans = min(ans, abs(p-t[tid])+abs(t[tid]-s[sid]));
		tid--;
		ans = min(ans, abs(p-s[sid])+abs(s[sid]-t[tid]));
		ans = min(ans, abs(p-t[tid])+abs(t[tid]-s[sid]));
		sid++;
		ans = min(ans, abs(p-s[sid])+abs(s[sid]-t[tid]));
		ans = min(ans, abs(p-t[tid])+abs(t[tid]-s[sid]));
		cout << ans << "\n";
	}	

	return 0;
}

Measured memory_bytes: 4608
#!/usr/bin/env pytHon3
# -*- coding: utf-8 -*-


def main():
    H, W = map(int, input().split())

    if H % 3 == 0 or W % 3 == 0:
        print(0)
        exit()

    area = H * W / 3
    result = min(H, W)

    for H1 in range(1, H):
        if area // H1 > W:
            continue
        else:
            W1s = [int(area // H1), int(area // H1) + 1]

        for W1 in W1s:
            if W1 == W:
                continue
            else:
                H2 = H - H1
                W2s = [W1, W]

            for W2 in W2s:
                W3 = W - W1
                if W2 == W1:
                    H3 = H
                else:
                    H3 = H1

                areas = [H1 * W1, H2 * W2, H3 * W3]
                if max(areas) - min(areas) < result:
                    result = max(areas) - min(areas)

    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
//
// Created by kashi on 20-06-2020.
//
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define Endl endl
#define int long long
int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
bool cmp(pair<int,int> a, pair<int,int>b) {
    return a.second<b.second;
}

int32_t main(){
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    int sum=0;
    for(int i=0;i<k;i++)
        sum+=a[i];
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<math.h>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>
// 追加１
#include <fstream>



using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 2019;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()



int main()
{
    ll A, B, N;
    cin >> A >> B >> N;

    ll x = min(N, B - 1);
    ll y = x / B;

    cout << (A * x) / B - A * y << endl;

    return 0;
}

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


Measured memory_bytes: 128
import heapq

k, t = map(int, input().split())
a = list(map(int, input().split()))

q = []
heapq.heapify(q)

for i in range(t):
    heapq.heappush(q, [a[i] * -1, i])

ans = 0
prev = -1

while len(q) > 0:
    num, idx = heapq.heappop(q)
    if idx == prev and len(q) > 0:
        num2, idx2 = heapq.heappop(q)
        heapq.heappush(q, [num, idx])
        num, idx = num2, idx2

    if idx == prev:
        ans += 1
    num *= -1
    num -= 1
    if num > 0:
        heapq.heappush(q, [num * -1, idx])
    prev = idx

print(ans)


Measured memory_bytes: 74728
#include<iostream>
#include<vector>
#include<cmath>
#define rep(i,n,m) for(int i=(int)(n);i<(int)(m);++i)
typedef long long int lli;
using namespace std;
int main(){
  int i;
  int n,sum=0,ans=0;
  cin>>n;
  vector<int> h(n+1,1000000001);
  rep(i,0,n)
    cin>>h.at(i);
  rep(i,0,n){
    //cout<<h.at(i)<<' ';
    if(h.at(i)<h.at(i+1)){
      ans=max(sum,ans);
      sum=0;
      continue;
    }
    ++sum;
  }
  cout<<ans<<endl;
  return 0;
}

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

#define pow(n) (n)*(n)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

#define space cout << endl;
#define test_data(data) cout << data << endl;
#define test_comp(var1, var2) cout << var1 << " " << var2 << endl;

using namespace std;

/* function */
//  - none - 


/* code */
int main (void) 
{

  /* Variable_Proclamation */
  int N;    // input

  int i;    // subscript
  int sum, min_sum;


  /* Input, Array_Proclamation */
  cin >> N ;
  vector<char> S(N), S_rev(N);
  vector<int>  nomal_sum(N+1);
  vector<int>  reverse_sum(N+1);

  for(i=0; i<N; i++)
  {
    cin >> S.at(i);
    S_rev.at(i) = S.at(i);
  }
  reverse( all(S_rev) );


  /* Initialize */
  min_sum = INT_MAX;


  /* Calculation */
  nomal_sum.at(0)   = 0;
  reverse_sum.at(N) = 0;

  for(i=1; i<=N; i++)
  {

    nomal_sum.at(i)   = nomal_sum.at(i-1);
    reverse_sum.at(i) = reverse_sum.at(i-1);

    (S.at(i-1) == 'W')?     nomal_sum.at(i) += 1:   nomal_sum.at(i)   += 0;
    (S_rev.at(i-1) == 'E')? reverse_sum.at(i) += 1: reverse_sum.at(i) += 0;

  }

  // for(i=0; i<N+1; i++)
  // {
  //   test_comp(nomal_sum.at(i), reverse_sum.at(i) );
  // }

  reverse( all(reverse_sum) );

  for(i=1; i<=N; i++)
  {
    // sum     = nomal_sum.at(i-1) + reverse_sum.at(i-1);
    sum     = nomal_sum.at(i-1) + reverse_sum.at(i);
    
    // test_data(sum);
    
    min_sum = min(sum, min_sum);
  }
  

  /* Output */
  // space;
  cout << min_sum << endl;


  return 0;

}


/* entity */
//  - none -




Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int D;
    cin >> D;
    vector<ll> c(26,0);
    for(auto &x:c){
        cin >> x;
    }

    vector<vector<ll>> s(D,vector<ll>(26,0));
    for(auto &line:s){
        for(auto &x:line){
            cin >> x;
        }
    }

    vector<ll> last_day(26,-1);

    ll ans=0;
    for(int i=0; i<D; i++){
        int t;
        cin >> t;
        t--;

        ans+=s[i][t];
        last_day[t]=i;
        for(int j=0; j<26; j++){
            ans-=c[j]*(i-last_day[j]);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    for(int i=0;i<N;i++){
        int h;
        cin >> h;
        H.at(i)=h;
    }
    vector<bool> P(N, 1);
    for(int i=0; i<M; i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        if(H.at(a)>=H.at(b)){
            P.at(b)=0;
        }
        if(H.at(a)<=H.at(b)){
            P.at(a)=0;
        }
    }
    int count = 0;
    for(int i=0; i<N; i++){
        if(P.at(i)){
            count++;
        }
    }
    cout << count;
}

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


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    int ans=1000;
    rep(i,S.size()-2){
        string A=S.substr(i,3);
        int x=atoi(A.c_str());
        x=abs(x-753);
        ans=min(ans,x);
    }
    cout << ans <<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e9) + 1;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, n) for(int i = 1; i <= (int)(n); i++)
#define scn(n) scanf("%d", &n)
#define scns(s) scanf("%s", &s)
#define pri(n) printf("%d", n)
#define priln(n) printf("%d\n", n)
#define pris(s) printf("%s", s)
#define prisln(s) printf("%s\n", s)
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; }

int main()
{
  int n;
  int A[3][3];
  int r[3][3];

  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> A[i][j];
    }
  }

  scn(n);
  int b[n];
  rep(i, n) scn(b[i]);

  rep(i, 3) {
    rep(j, 3) {
      r[i][j] = 0;
    }
  }

  rep(i, n) {
    rep(j, 3) {
      rep(k, 3) {
        if (A[j][k] == b[i]) r[j][k] = 1;
      }
    }
  }

  int cnt = 0;
  string ans = "No";

  rep(i, 3) {
    cnt = 0;
    rep(j, 3) {
      cnt += r[i][j];
    }
    if (cnt == 3) ans = "Yes";
  }

  rep(j, 3) {
    cnt = 0;
    rep(i, 3) {
      cnt += r[i][j];
    }
    if (cnt == 3) ans = "Yes";
  }

  cnt = 0;
  cnt += r[0][0];
  cnt += r[1][1];
  cnt += r[2][2];
  if (cnt == 3) ans = "Yes";

  cnt = 0;
  cnt += r[0][2];
  cnt += r[1][1];
  cnt += r[2][0];
  if (cnt == 3) ans = "Yes";

  cout << ans << endl;

  return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        char[] input = Console.ReadLine().ToArray();
        int max = 0;
        int temp = 0;
        for(int i = 0; i < input.Length; i++)
        {
            if(input[i]=='A'|| input[i] == 'G'|| input[i] == 'T'|| input[i] == 'C')
            {
                temp++;
            }
            else
            {
                if (max < temp) { max = temp; }
                temp = 0;
            }
        }
        if (max < temp) { max = temp; }
        Console.WriteLine(max);
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
 
		Scanner scan = new Scanner(System.in);
 
		int N = scan.nextInt();
 
		int  a[] = new int[N];
		int count = 0;
 
		for(int i = 0; i < N; i++) {
			a[i] = scan.nextInt();
		}
 
		int x = 1;
		for(int i = 0; i < N; i++) {
			// 左からi番目 == i
			// すぬけさんが満足
			if(a[i] == x) {
				x++;
			}else {
				count++;
			}
		}
 
		// 砕くの不可能
		if(count == a.length) {
			System.out.println(-1);
		}else {
			System.out.println(count);
		}
 
	}
}

Measured memory_bytes: 78632
#include<stdio.h>
int main()
{
 int a,b,x,y,z;
 scanf("%d%d",&a,&b);
 x=a+b;
 y=a-b;
 z=a*b;
 if (x>=y && x>=z)
 {
     printf("%d",x);
 }
 else
    {
    if (y>=x && y>=z)
    {
        printf("%d",y);
    }
    else if (z>=x && z>=y)
    {
        printf("%d",z);
    }

 }
 return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define INF (1<<20)

int main(){
  int N;
  while(1){
    cin >> N;
    if(N == 0) break;
    int a[40002]={0};
    int b[40002]={0};
    for(int i=1;i<=N;i++){
      cin >> a[i];
    }
    for(int i=1;i<=N;i++){
      cin >> b[i];
    }
    a[0] = b[0] = INF;
    sort(a,a+N+1,greater<int>() );
    sort(b,b+N+1,greater<int>() );
    int idx = 1;
    int losecnt[40002]={0};
    int s=1,t=1;
    while(s <= N && t <= N){
      while(a[s] > b[t] && s <= N) s++;
      if(s <= N && b[t] >= a[s]){
	losecnt[s]++;
	s++; t++;
      }
    }
    for(int k=1;k<=N;k++){
      losecnt[k] += losecnt[k-1];
    }
    int ret = -1;
    for(int k=1;k<=N;k++){
      if(k-losecnt[k] >= (k+2)/2) {
	ret = k;
	break;
      }
    }
    if(ret==-1||ret==N) cout << "NA" << endl;
    else cout << ret << endl;
  }
}

Measured memory_bytes: 3628
#pragma GCC optimize("O3", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int main(void){
    int N; cin >> N;
    vector<int> D(N);
    for (int i = 0; i < N; ++i)
        cin >> D[i];
    sort(D.begin(), D.end(), greater<int>());
    int res = 0;
    // 高橋君から見て、N人全員が同じ側
    int tmp = 24 - D[0];
    for (int i = 0; i < N - 1; ++i)
        tmp = min(tmp, D[i] - D[i + 1]);
    tmp = min(tmp, D[N - 1]);
    res = max(res, tmp);
    // 初めて違う方向に割り当てたのが人i
    for (int i = 1; i < N; ++i){
        tmp = 24 - (D[0] + D[i]);
        for (int j = 0; j < i - 1; ++j)
            tmp = min(tmp, D[j] - D[j + 1]);
        for (int j = i; j + 2 < N; j += 2)
            tmp = min(tmp, D[j] - D[j + 2]);
        for (int j = i - 1; j + 2 < N; j += 2)
            tmp = min(tmp, D[j] - D[j + 2]);
        tmp = min(tmp, D[N - 1]);
        if (N > 1) tmp = min(tmp, D[N - 2]);
        res = max(res, tmp);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque

N = int(input())

D = list(map(int,input().split()))

ans = 0

dic = {}
dic[0] = 1

for i in D:

    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1

q = deque([[]])

for i in dic:
    nq = deque([])

    if dic[i] >= 3 or (i in [0,12] and dic[i] >= 2):
         print (0)
         sys.exit()

    elif dic[i] == 2:

        for j in q:
            nj = j.copy()
            nj.append(i)
            nj.append(24-i)
            nq.append(nj)

    else:

        for j in q:

            nj = j.copy()
            nj.append(i)
            nq.append(nj)

            if i not in [0,12]:
                nj = j.copy()
                nj.append(24-i)
                nq.append(nj)

    q = nq

#print (q)

while len(q) > 0:

    nlis = q.pop()
    nlis.sort()

    nlis.append(nlis[0])
    nmin = float("inf")

    for i in range(len(nlis)-1):
        
        nmin = min(nmin, abs(nlis[i] - nlis[i+1]) , 24 - abs(nlis[i] - nlis[i+1]))

    ans = max(ans,nmin)

print (ans)


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

template<typename T>
istream& operator>> (istream& is, vector<T> &vec){
    for(T& x: vec) is >> x;
    return is;
}

int main(){
    ll h, w; cin >> h >> w;
    vector<vector<ll>> field(20, vector<ll>(20, -1));
    rep(i, h){
        rep(j, w){
            char tmp; cin >> tmp;
            if(tmp == '.') field[i][j] = 0;
        }
    }

    ll ans = -1;
    rep(i, h){
        rep(j, w){
            if(field[i][j] == -1) continue;
            vector<vector<ll>> tmp = field;
            queue<pair<ll,ll>> que;
            que.emplace(i, j);

            while(!que.empty()){
                ll x = que.front().second, y = que.front().first;
                que.pop();

                ll dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
                rep(k, 4){
                    ll nx = x + dx[k], ny = y + dy[k];
                    if(nx < 0 || nx >= w || ny < 0 || ny >= h || tmp[ny][nx] != 0 || (ny == i && nx == j)) continue;
                    tmp[ny][nx] = tmp[y][x] + 1;
                    que.emplace(ny, nx);
                }
                //cout << que.front().second << " " << que.front().first << endl;
            }

            rep(k, h) ans = max(ans, *max_element(tmp[k].begin(), tmp[k].end()));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        final int N = sc.nextInt();
        final int R = sc.nextInt();

        System.out.println(N >= 10 ? R : R + 100 * (10 - N));
    }
}


Measured memory_bytes: 23764
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
m=len(bin(max(a+[k])))-2
b=[0]*m
ans=""
x=0
a2=[bin(i)[2:] for i in a]
for i in a2:
    for j in range(-1,-len(i)-1,-1):
        b[j]+=int(i[j])
B=len(b)
for (i,j) in enumerate(b):
    if j<(n/2) and k>=2**(B-i-1):
        ans=ans+"1"
        k-=2**(B-i-1)
    else:
        ans=ans+"0"
ans=int(ans,2)
for i in a:
    x+=ans^i
print(x)

Measured memory_bytes: 18860
package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

func Factorial(N int) (F, Finv []int) {
  F = make([]int, N + 1)
  Finv = make([]int, N + 1)
  inv := make([]int, N + 1)
  F[0] = 1
  F[1] = 1
  Finv[0] = 1
  Finv[1] = 1
  inv[0] = 1
  inv[1] = 1
  for i := 2; i < N + 1; i++ {
    F[i] = F[i - 1] * i % p
    inv[i] = p - inv[p % i] * (p / i) % p
    Finv[i] = Finv[i - 1] * inv[i] % p
  }
  return
}

func Comb(F, Finv *[]int, a, b int) (ret int) {
  ret = (*F)[a + b] * ((*Finv)[a] * (*Finv)[b] % p) % p
  return
}

const p = 1000000007

func Max(x, y int) int {
  if x < y { return y }
  return x
}

func Min(x, y int) int {
  if x < y { return x }
  return y
}

func main() {
  XY := NextIntVec()
  X, Y := XY[0], XY[1]
  F, Finv := Factorial(Min(X, Y))
  cnt := 0
  for N := (Max(X, Y) + 1) / 2; N < Min(X, Y) + 1; N++ {
    two := X - N
    one := N - two
    if one < 0 || two < 0 { continue }
    if 2 * one + two != Y { continue }
    cnt += Comb(&F, &Finv, one, two)
    cnt %= p
  }
  Write(cnt)
  Output()
}

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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

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

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
 ll gcd(ll a,ll b){
 if(b == 0) return a;
 return gcd(b,a%b);
 }

//最小公倍数
 ll lcm(ll a,ll b){
 ll g = gcd(a,b);
 return a / g * b; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

int main(){
int N;
cin >> N;
vector<ll>a(N);
REP(i, N) cin >> a.at(i);

ll four = 0, two = 0 , odd = 0;

REP(i, N){
	if(a.at(i) % 4 == 0 ) four++;
	// else if(a.at(i) % 4 != 0 && a.at(i) % 2 == 0) two++;
	else if(a.at(i) % 2 == 1) odd++;
}
// print(odd);
// print(four);

if(odd == 0) yes;
else if(four >= odd) yes;
else if(a.size() % 2 == 1 && four >= odd - 1) yes;
else no;
}


Measured memory_bytes: 1024
import java.util.*;
import java.util.Map.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<String, Integer> map = new HashMap<String, Integer>();
        while (n-- > 0) {
            int num = sc.nextInt();
            String strNum = String.valueOf(num);
            if (!map.containsKey(strNum)) {
                map.put(strNum, 1);
            } else {
                int v = map.get(strNum);
                map.put(strNum, v + 1);
            }
        }
        
        int count = 0;
        for (Entry<String, Integer> entry : map.entrySet()) {
            int key = Integer.parseInt(entry.getKey());
            int val =  entry.getValue();
            
            if (val > key) {
                count += val - key;
            } else if (val < key) {
                count += val;
            }
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 66032
function main(input){
    let lines=input.split("\n");
    let i=0;
    while(lines[i]!=="0 0"){
        console.log(board(lines[i]));
        console.log("");
        i++;
        
        
    }
    
}
function board(line){
    let nums = line.split(" ").map(item=>parseInt(item));
    let height = nums[0];
    let width = nums[1]
    let put ="";
    
    for(let i=0;i<height;i++){
        if(i===0||i===height-1){
            for(let j=0;j<width;j++){
                put+="#";
            }
        }else{
            for(let j=0;j<width;j++){
                if(j===0||j===width-1){
                    put+="#";
                }else{
                    put+=".";
                }
                
            }
        }
        
        if(i!==height-1){
            put+="\n";
        }
    }
    return put.trim();
    
}


main(require("fs").readFileSync("/dev/stdin","utf-8"));


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

#define int long long
#define pii pair<int, int>
#define pb push_back

signed main(){

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

    double n;
    cin  >> n;
    cout << setprecision(7) << fixed;
    n /= 3.0;
    cout << n * n * n << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt(); long m = sc.nextLong();
        long [] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = sc.nextInt();
        Set<Integer> two = new HashSet<>();
        for (int i = 0; i < n; i++) {
            int at = 0;
            long cur = a[i];
            while (cur % 2 == 0) {
                cur /= 2;
                at++;
            }
            two.add(at);
        }
        if (two.size() > 1) {
            out.println(0);
            out.close();
            return;
        }
        for (int i = 0; i < n; i++) a[i] = a[i] / 2;
        long lcm = a[0]; boolean bad = false;
        for (int i = 1; i < n; i++) {
            long gcd = gcd(lcm, a[i]);
            lcm = (lcm * a[i]) / gcd;
            if (lcm > m) {
                bad = true; break;
            }
        }
        if (bad) {
            out.println(0);
        } else {
            out.println(m / lcm - m / (2 * lcm));
        }
        out.close();
    }

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


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 47496
using System;
using System.Collections;
using System.Collections.Generic;

public class AOJ11
{
    public static void Main()
    {
        int W, H;
        string[] field = new string[20];
        int[] dx = { -1, 0, 1, 0 };
        int[] dy = { 0, -1, 0, 1 };
        Queue q = new Queue();
        while (true)
        {
            string[] v = Console.ReadLine().Split(' ');
            W = Int32.Parse(v[0]); H = Int32.Parse(v[1]);
            if (W == 0 && H == 0) break;
            for (int i = 0; i < H; i++) field[i] = Console.ReadLine();
            bool[,] flag = new bool[H, W];
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    if (field[i][j] == '@')
                    {
                        q.Enqueue(new KeyValuePair<int, int>(i, j));
                        flag[i, j] = true;
                        goto stop;
                    }
                }
            }
        stop:
            while (q.Count > 0)
            {
                KeyValuePair<int, int> T = (KeyValuePair<int, int>)q.Peek();
                int y = T.Key; int x = T.Value;
                q.Dequeue();
                for (int i = 0; i < 4; i++)
                {
                    if (x + dx[i] < 0 || W <= x + dx[i] || y + dy[i] < 0 || H <= y + dy[i]) continue;
                    if (field[y + dy[i]][x + dx[i]] == '#' || flag[y + dy[i], x + dx[i]] == true) continue;
                    flag[y + dy[i], x + dx[i]] = true;
                    q.Enqueue(new KeyValuePair<int, int>(y + dy[i], x + dx[i]));
                }
            }
            int cnt = 0;
            for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) if (flag[i, j] == true) cnt++;
            Console.WriteLine(cnt);
        }
    }
}

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

int64_t gcd(int64_t a, int64_t b)
{
  if (a < b)
    return gcd(b, a);

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

int main()
{
  int n;
  int64_t ans;
  cin >> n;
  vector<int64_t> A(n);
  for (int i = 0; i < n; ++i)
    cin >> A[i];
  ans = gcd(A[0], A[1]);

  for (int i = 2; i < n; ++i)
  {
    ans = gcd(ans, A[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
using ll=long long;
using namespace std;
const auto mod=1e9+7;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  
  int n,k; cin>> n >> k;
  ll ans;
  vector<ll> h(n);
  rep(i,0,n) cin >> h[i];
  sort(h.begin(),h.end());
  rep(i,0,n-k) ans+=h[i];
  cout << ans << endl;
} 






Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;




int main()
{
	int N, ans = 0, check = 0;
	char c;
	string S;

	cin >> N;
	cin >> S;

	int mark = 0;
	for (int j = 1; j < N; j++) {
		if (S[j] == 'E') mark++;
	}
	ans = mark;
	check = mark;
	for(int i = 1; i < N; i++){
		if (S[i - 1] == 'W') check++;
		if (S[i] == 'E') check--;
		ans = min(ans, check);
	}
	


	cout << ans;

	char qq;
	cin >> qq;
	return 0;
}

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

using namespace std;


void solve() {
    int n; cin >> n;
    int res = 0;
    auto f = [](int x){
        int e = 0;
        while (x%2==0) {
            x/=2;
            e++;
        }
        return e;
    };
    for (int _ = 0; _ < n; _++) {
        int x; cin >> x;
        res += f(x);
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
S = input()
T = input()

found = []
for i in range(len(S) - len(T) + 1):
    for cs,ct in zip(S[i:],T):
        if cs != '?' and cs != ct:
            break
    else:
        found.append(i)

if not found:
    print('UNRESTORABLE')
    exit()

ans = 'z' * 51
for i in found:
    tmp = S[:i] + T + S[i+len(T):]
    ans = min(ans, tmp.replace('?', 'a'))
print(ans)

Measured memory_bytes: 3064
n = int(input())

playlist = []
for _ in range(n):
    title, time = input().split()
    time = int(time)
    playlist.append([title, int(time)])

x = input()

sleep = False
ans = 0
for title, time in playlist:
    if sleep:
        ans += time
    if title == x:
        sleep = True

print(ans)


Measured memory_bytes: 3060
/*
    Author - Param Kothari
    Ah shit, here we go again
*/
 
/* Ordered Set Implementaton:

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;

typedef tree<
    int,
    null_type,
    less<int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
ordered_set;
*/

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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define mk make_pair 
 
typedef long long ll;
typedef long double ld;

void solve(){
    int n = 0, k = 0, flag = 0;
    cin >> n >> k;
    map<int, int> m;
    string res = "";
    if(n == 1) res = "0";
    else if(n == 2) res = "10";
    else res = "100";
    for(int i = 0; i < k; i++){
        int si, ci;
        cin >> si >> ci;
        si--;
        if(si == 0 && ci == 0 && n > 1){
            flag = 1;
        }
        if(m.find(si) != m.end()){
            if(m[si] != ci){
                flag = 1;
            }
        }
        else m[si] = ci;
    }
    if(flag == 1){
        cout << -1 << "\n";
        return;
    }
    for(auto x : m){
        res[x.first] = x.second + '0';
    }
    cout << res << "\n";
    return;
}

int main(){
    IOS;
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


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

int main()
{
  string w;
  cin >> w;
  vector<int> count(26);
  int i, s;
  s = 0;
  for(i = 0; i < w.size(); i++)
  {
    count.at(w.at(i)-97)++;
  }
  for(i = 0; i < 26; i++)
  {
    if(count.at(i) % 2 != 0)
    {
      s = 1;
      break;
    }
  }
  if(s == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        AtCoder problem = new AtCoder(sc);
        problem.solve(out);

        out.flush();
    }

}

class AtCoder {

    int X;

    AtCoder(FastScanner sc) {
        X = sc.nextInt();
    }

    void solve(PrintWriter out) {
        switch (X) {
            case 7:
            case 5:
            case 3:
                out.println("YES");
                break;
            default:
                out.println("NO");
                break;
        }
    }

}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

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

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

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

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

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

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

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

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

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


Measured memory_bytes: 21460
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {
	static ContestScanner in;
	static Writer out;
	public static void main(String[] args) {
		try {
			in = new ContestScanner();
			out = new Writer();
			new Main().solve();
			in.close();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	void solve() throws IOException {
		int n = in.nextInt();
		int m = in.nextInt();
		int[] into = new int[n];
		for(int i = 0; i < m; i++) {
			int a = in.nextInt() - 1;
			int b = in.nextInt() - 1;
			into[a]++;
			into[b]++;
		}
		for(int i = 0; i < n; i++) {
			if(into[i] % 2 == 1) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}


class Writer extends PrintWriter{
	public Writer(String filename)throws IOException
	{super(new BufferedWriter(new FileWriter(filename)));}
	public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
	private BufferedReader in;private int c=-2;
	public ContestScanner()throws IOException 
	{in=new BufferedReader(new InputStreamReader(System.in));}
	public ContestScanner(String filename)throws IOException
	{in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
	public String nextToken()throws IOException {
		StringBuilder sb=new StringBuilder();
		while((c=in.read())!=-1&&Character.isWhitespace(c));
		while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public String readLine()throws IOException{
		StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
		while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public long nextLong()throws IOException,NumberFormatException
	{return Long.parseLong(nextToken());}
	public int nextInt()throws NumberFormatException,IOException
	{return(int)nextLong();}
	public double nextDouble()throws NumberFormatException,IOException 
	{return Double.parseDouble(nextToken());}
	public void close() throws IOException {in.close();}
}

Measured memory_bytes: 41424
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))


Measured memory_bytes: 16152
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	namespace impl
	{
		struct max_t
		{
			template<class T>constexpr T operator()(T&& lhs, T&& rhs)const
			{
				return std::max(lhs, rhs);
			}
		};
		struct min_t
		{
			template<class T>constexpr T operator()(T&& lhs, T&& rhs)const
			{
				return std::min(lhs, rhs);
			}
		};
	}
	constexpr impl::max_t max;
	constexpr impl::min_t min;

	template<class T>auto orderby(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min(); 

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

void Main()
{
	std::string name[] = { "pon","pon","hon","bon","hon","hon","pon","hon","pon","hon" };
	int N;
	std::cin >> N;
	std::cout << name[N % 10] << std::endl;
}

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

Measured memory_bytes: 3660