akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl


int main(void) {
    int i, sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    sx += 1500; sy += 1500; tx += 1500; ty += 1500;

    string ans;
    REP (i,tx-sx) ans += 'R';
    REP (i,ty-sy) ans += 'U';

    REP (i,tx-sx) ans += 'L';
    REP (i,ty-sy) ans += 'D';

    ans += 'D';
    REP (i,tx-sx+1) ans += 'R';
    REP (i,ty-sy+1) ans += 'U';
    ans += 'L';

    ans += 'U';
    REP (i,tx-sx+1) ans += 'L';
    REP (i,ty-sy+1) ans += 'D';
    ans += 'R';
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
let n = stdin.ReadLine() |> int

let a =
  seq {
    for i in 0 .. n - 1 -> (i, stdin.ReadLine() |> (fun x -> int x - 1))
  }
  |> Map

let ans =
  [
    let mutable tmp = 0
    yield tmp
    for i in 1 .. n do
      tmp <- a.[tmp]
      yield tmp
  ]
  |> List.tryFindIndex (fun i -> i = 1)
  |> (fun x ->
        match x with
        | Some i -> i
        | None -> -1 )

ans |> stdout.WriteLine

Measured memory_bytes: 24080
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define oo 100000
 
using namespace std;
 
int32_t main ()
{
	//ios_base::sync_with_stdio(0);
	//cin.tie(0);cout.tie(0);
	
	int n;
	cin>>n;
	vector<int> v(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
	}	
	map<int,int> mp;
	vector<bool> visited(n);
	sort(v.begin(), v.end());
	for(int i=0;i<n;i++){
		if(visited[i])continue;
		
		if(i && v[i]==v[i-1]){
			visited[i]=1;
			visited[i-1]=1;
		}
		
		else if(!i && n>1 && v[i]==v[i+1]){
			visited[i]=1;
			visited[i+1]=1;
		}
		
		if(mp.find(v[i])!=mp.end()){
			visited[i]=1;
			continue;
		}
		mp[v[i]]++;

		for(int j=2;j*v[i]<1000000+1;j++){
			mp[v[i]*j]++;
		}

	}

	int ans=0;
	for(int i=0;i<n;i++){
		if(!visited[i])ans++;
	//	else cout<<v[i]<<endl;
	}

	cout<<ans<<endl;

	return 0;
}


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

int main(){

    int N;
    cin >> N;

    int ans = 0;
    int cnt = 0;

    for (int i=1; i<N+1; i++){
        
        int temp = i;
        int cnt_buf = 0;

        while(temp != 0){
//            cout << i/2 << endl;
            if (temp%2==0) cnt_buf++;
            temp /= 2;
//            cout << i << endl;
        }
        if (cnt < cnt_buf) {
            cnt = cnt_buf;
            ans = i;
        }
    }

    if (cnt != 0) cout << ans << endl;
    else cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;
#define dump(a) cout << (a) << endl;
typedef long long ll;

int main() {
    int n, c;
    cin >> n >> c;
    int d[50][50] = {};
    for (int i = 0; i < c; i++) for (int j = 0; j < c; j++) cin >> d[i+1][j+1];
    int x[50] = {}, y[50] = {}, z[50] = {};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int tmp;
            cin >> tmp;
            if( (i+j)%3 == 0 ) x[tmp]++;
            else if( (i+j)%3 == 1 ) y[tmp]++;
            else if( (i+j)%3 == 2 ) z[tmp]++;
        }
    }
    int res = 1e9;
    for (int i = 1; i <= c; i++) {
        for (int j = 1; j <= c; j++) {
            if( i == j ) continue;
            for (int k = 1; k <= c; k++) {
                if( i == k || j == k ) continue;
                ll sum = 0;
                for (int l = 1; l <= c; l++) sum += d[l][i]*x[l];
                for (int l = 1; l <= c; l++) sum += d[l][j]*y[l];
                for (int l = 1; l <= c; l++) sum += d[l][k]*z[l];
                if( sum < res ) res = sum;
            }
        }
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(void) {}
  Edge(int src, int dst) : src(src), dst(dst) {}
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void edges_to_graph(Graph &graph, const Edges &edges, const int vertices, const bool directed = true) {
  graph.resize(vertices);
  for (const auto &e : edges) graph[e.src].emplace_back(e);
  if (!directed) for (const auto &e : edges) graph[e.dst].emplace_back(Edge(e.dst, e.src, e.weight));
}

int main(void) {
  int n, m;
  cin >> n >> m;
  Graph graph;
  Edges edges(m);
  rep (i, m) {
    int s, t;
    cin >> s >> t;
    edges[i] = {--s, --t};
  }
  edges_to_graph(graph, edges, n);
  vector<double> svp(n), nv(n);
  svp[0] = 1;
  rep (i, n - 1) {
    double p = svp[i] / graph[i].size();
    allrep (e, graph[i]) svp[e.dst] += p;
  }
  rrep (i, n - 1) {
    double sum = 0;
    allrep (e, graph[i]) sum += nv[e.dst];
    nv[i] = sum / graph[i].size() + 1;
  }
  double maxdec = 0;
  rep (i, n - 1) {
    const int en = graph[i].size();
    if (en == 1) continue;
    double maxi = -1;
    allrep (e, graph[i]) maxi = max(maxi, nv[e.dst]);
    double newnv = ((nv[i] - 1) * en - maxi) / (en - 1) + 1;
    maxdec = max(maxdec, (nv[i] - newnv) * svp[i]);
  }
  cout << nv[0] - maxdec << endl;
  return 0;
}

Measured memory_bytes: 5888
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

const int MAXN = 1e5 + 100;
const int inf = 0x3f3f3f3f;
int n, k;
long long dp[105][MAXN];//dp[i][j]：前i个物品，容量为j时的最大价值
int w[MAXN];
long long v[MAXN];

int main(){
	scanf("%d %d", &n, &k);
	for(int i = 1; i <= n; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		w[i] = a, v[i] = b;
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= k; j++){
			if(j < w[i]) dp[i][j] = dp[i-1][j];
			else dp[i][j] = dp[i-1][j] > dp[i-1][j-w[i]]+v[i] ? dp[i-1][j] : dp[i-1][j-w[i]]+v[i];
		}
	}
	printf("%lld\n", dp[n][k]);
	return 0;
}

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

vector<int> dw = {1, 0, -1, 0};
vector<int> dh = {0, 1, 0, -1};

struct Edge { ll h, w, cost; };
vector<Edge> G[1001][1001];

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

  ll H; cin >> H;
  ll W; cin >> W;
  ll Ch; cin >> Ch; Ch--;
  ll Cw; cin >> Cw; Cw--;
  ll Dh; cin >> Dh; Dh--;
  ll Dw; cin >> Dw; Dw--;

  vector<vector<ll>> cells(H, vector<ll>(W, 0));
  vector<vector<ll>> d(H, vector<ll>(W, 1e15));
  for (ll i = 0; i < H; i++) {
    string S; cin >> S;
    for (ll j = 0; j < W; j++) {
      if (S[j] == '#') cells[i][j] = 1;
    }
  }

  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      for (ll k = 0; k < 4; k++) {
        ll nh = i + dh[k];
        ll nw = j + dw[k];
        if (nh < 0 || nw < 0 || nh >= H || nw >= W) continue;
        if (cells[nh][nw] > 0) continue;
        G[i][j].emplace_back(Edge({nh, nw, 0}));
      }

      for (ll k = -2; k <= 2; k++) {
        for (ll l = -2; l <= 2; l++) {
          ll nh = i + k;
          ll nw = j + l;
          if (nh < 0 || nw < 0 || nh >= H || nw >= W) continue;
          if (cells[nh][nw] > 0) continue;
          G[i][j].emplace_back(Edge({nh, nw, 1}));
        }
      }
    }
  }

  priority_queue<P, vector<P>, greater<P>> q;
  d[Ch][Cw] = 0;
  q.push(P(0, {Ch, Cw}));

  while (!q.empty()) {
    P p = q.top(); q.pop();
    int h = p.second.first, w = p.second.second;
    if (d[h][w] < p.first) continue;
    for (int i = 0; i < G[h][w].size(); i++) {
      Edge e = G[h][w][i];
      if (d[e.h][e.w] > d[h][w] + e.cost) {
        d[e.h][e.w] = d[h][w] + e.cost;
        q.push(P(d[e.h][e.w], {e.h, e.w}));
      }
    }
  }

  ll ans = d[Dh][Dw];
  if (ans >= 1e15) ans = -1;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 524072
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans = 0;
    
    for(int i=0;i<(a*3+b)/2;i++){
      ans++;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 20948
daise=list(map(int,input().split()))
a=input()
A=list(a)
n=len(A)
for m in range(n):
	if A[m]=='S':
		x=daise[0]
		daise[0]=daise[4]
		daise[4]=daise[5]
		daise[5]=daise[1]
		daise[1]=x
	elif A[m]=='E':
		x=daise[0]
		daise[0]=daise[3]
		daise[3]=daise[5]
		daise[5]=daise[2]
		daise[2]=x
	elif A[m]=='W':
		x=daise[0]
		daise[0]=daise[2]
		daise[2]=daise[5]
		daise[5]=daise[3]
		daise[3]=x
		pass
	elif A[m]=='N':
		x=daise[0]
		daise[0]=daise[1]
		daise[1]=daise[5]
		daise[5]=daise[4]
		daise[4]=x
		pass
print(daise[0])


Measured memory_bytes: 5608
mod = 10**9+7
n = int(input())
num = [ int(v) for v in input().split() ]

dup = [ None for i in range(n) ]
for i, v in enumerate(num):
    if dup[v-1] == None:
        dup[v-1] = i
    else:
        l, r = dup[v-1], n-i
        break

def all_combination_with_mod(m):
    ret_list = [ 1 for i in range(m+1) ]
    for i in range(m):
        a = ret_list[i] * (m-i) * pow(i+1,mod-2,mod)
        ret_list[i+1] = a % mod
    return ret_list

ans_list = all_combination_with_mod(n+1)[1:]
sub_list = all_combination_with_mod(l+r)


for i in range(l+r+1):
    ans_list[i] -= sub_list[i]
    ans_list[i] %= mod

for i in ans_list:
    print(i)

Measured memory_bytes: 84460
import java.util.*;
import java.lang.*;
import java.io.*;

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

        int c = 0;

        for(int i = 0; i<N; i++){
            p[i] = sc.nextInt();
            q[i] = p[i];
        }
        Arrays.sort(q);

        for(int i = 0; i < N; i++){
            if(p[i] != q[i]){
                c++;
            }
        }

        if(c > 2){
            System.out.println("NO");
        }else{
            System.out.println("YES");
        }

    }
}

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

ll solve(ll N,ll M,string& s,string& t){
    ll g = gcd(N, M);
    ll L = N / g * M;
    ll u = L / N, v = L / M;

    map<ll, char> e;
    rep(i,N){
        e[u*i] = s[i];
    }
    rep(i,M){
        ll at = v*i;
        if (found(e,at) && e[at] != t[i]) return -1;
    }

    return L;
}

int main() {
    int n,m; cin >> n >> m;
    string s,t; cin >> s >> t;
    cout << solve(n,m,s,t) << endl;
    return 0;
}


Measured memory_bytes: 6144
n = int(input())
a_s = list(map(lambda x: int(x)-1, input().split()))
b_s = list(map(int, input().split()))
c_s = list(map(int, input().split()))

s = 0
prev = -2
for i in range(n):
  s += b_s[a_s[i]]
  if a_s[i] - prev == 1 and prev < n-1:
    s += c_s[prev]
  prev = a_s[i]

print(s)

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int n,a,b;
    int ret;
    scanf("%d %d %d",&n,&a,&b);
    ret=min(a,b);
    if(a+b>n){printf("%d %d",ret,a+b-n);}
    else{printf("%d 0\n",ret);}
    return 0;
}

int min(int a,int b){
    int ans;
    if(a>b){return b;}
    else {return a;}
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define fi first
#define se second
#define eb emplace_back
#define ef emplace_front
#define pof pop_front()
#define pob pop_back()
#define Rep(i,n) for(li i=0,nn=(li)(n);i!=nn;++i)
#define Rep1(i,n) for(li i=1,nn=(li)(n)+1;i!=nn;++i)
#define Size(v) (li)(v.size())
#define SortA(v) sort(v.begin(),v.end())
#define SortD(v) sort(v.rbegin(),v.rend())
#define All(a) (a).begin(),(a).end()
#define Input(a) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii);}
#define Input2(a,b) for(li ii=0,nn=(li)(a.size());ii!=nn;++ii){cin>>(a).at(ii)>>(b).at(ii);}
#define mp make_pair
using li = int64_t;
using intl = int64_t;
using vi = vec<li>;
using vb = vec<bool>;
using vvi = vec<vi>;
using qi = deque<li>;
using pi = pair<li,li>;
using vpi = vec<pi>;
using si = set<li>;
using vsi = vec<si>;
using mii = map<li,li>;
using vmii = vec<mii>;
vec<li> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<li> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr li INF = 9223372036854775807;

void Yes(li b){
  if(b)cout<<"Yes";
  else cout<<"No";
}
void yes(li b){
  if(b)cout<<"yes";
  else cout<<"no";
}

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

  li H;
  cin >>H;

  li times=0,ans=0;
  while(H>0){
  	H /= 2;
  	ans += (1LL<<times);
  	times ++;
  }

  cout <<ans;

}

Measured memory_bytes: 3664
#include <iostream>
using namespace std;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	int a, b; cin >> a >> b;
	if (b < 10) a *= 10;
	else if (b < 100) a *= 100;
	else if (b == 100) a *= 1000;

	for (int i = 0; i*i <= a + b; i++) {
		if (i*i == a + b) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

int main(){
    ll n,k;cin>>n>>k;
    vector<ll> a(n);

    ll key;
    rep(i,n){
        cin>>a[i];
        if(a[i]==1) key=i;
    }

    ll ans=INF;
    for(ll i=max(0ll,key-(k-1));i<=key;i++){
        ll sum=0;
        sum++;
        sum+=(i+k-2)/(k-1);
        sum+=(n-1-min(n-1,i+k-1)+k-2)/(k-1);

        chmin(ans,sum);
    }

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

Measured memory_bytes: 3976
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n; cin>>n;
	cout<<(n+1)/2;
	
	
	return 0;
}


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

int main(){
  vector <vector <char>> a(2,vector<char>(3));
  
  for(int i=0; i<2; i++){
    for( int j=0; j<3; j++){
      cin>> a.at(i).at(j);
    }
  }
  
  for( int j=0; j<a.at(0).size(); j++){
    if ( a.at(0).at(j) != a.at(1).at( a.at(0).size()-j-1)){
      cout << "NO" << endl;
      return 0;
    }
  }
  
  cout << "YES" << endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#define mod  1000000007
using namespace std;

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> h(m);
  vector<bool> v(n,true);
  for(int i=0;i<m;i++){
    cin >> h.at(i);
    v.at(h.at(i)) = false;
  }
  int stop = 0;
  for(int i=0;i<m-1;i++){
    if(h.at(i+1)-h.at(i) == 1){
      stop = -1;
      break;
    }
  }
  
  if(stop == -1){
    cout << 0 << endl;
  }
  else {
    vector<long long> dp(n+1);
    dp[0]=1;
    for(int i=0;i<n;i++){
      for(int j=i+1;j<=min(n,i+2);j++){
        if(v.at(i)){
          dp[j] += dp[i];
          dp[j] %= mod;
        }
      }
    }
    
    cout << dp[n] << endl;
  }
  return 0;
}


Measured memory_bytes: 1280
s=input()
ans=1000
import string
ss=string.ascii_lowercase
for c in list(ss):
    temp=s
    p=0
    nex=""
    while len(set(list(temp)))!=1:
        for i in range(len(temp)-1):
            if c in (temp[i],temp[i+1]):
                nex+=c
            else:nex+=temp[i]
        p+=1
        temp=nex
        nex=""
    ans=min(p,ans)
print(ans)

Measured memory_bytes: 3772
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n + 2];
        a[0] = 0;
        a[n + 1] = 0;
        long sum = 0;
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
            sum += Math.abs(a[i - 1] - a[i]);
        }
        sum += Math.abs(a[n] - a[n + 1]);

        for (int i = 1; i <= n; i++) {
            long ans = sum + Math.abs(a[i - 1] - a[i + 1])
                    - Math.abs(a[i - 1] - a[i]) - Math.abs(a[i] - a[i + 1]);
            System.out.println(ans);
        }
    }

}


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

using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;

template <class T>
using max_heap = priority_queue<T>;
template <class T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <class T, class U>
void chmax(T &a, U b) {
    if (a < b) a = b;
}
template <class T, class U>
void chmin(T &a, U b) {
    if (b < a) a = b;
}

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

const string YES = "Yes";
const string NO = "No";
void solve(std::string S) {

    if (S[2] == S[3] and S[4] == S[5]) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
    return;
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
using System;

namespace AGC002A{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            var A = sr.Next<int>();
            var B = sr.Next<int>();

            if(A <= 0 && B >= 0 || A >= 0 && B <= 0){
                Console.WriteLine("Zero");
            }
            if(A >= 1 && B >= 1){
                Console.WriteLine("Positive");
            }
            if(A <= -1 && B <= -1){
                Console.WriteLine(Math.Abs(A - B) % 2 == 1 ? "Positive" : "Negative");
            }
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];
        private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = _sr.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }

        public T[][] Next<T>(int y, int x){
            var ret = new T[y][];
            for(var i = 0; i < y; ++i) ret[i] = Next<T>(x);
            return ret;
        }
    }
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mp make_pair
#define pb push_back
#define pll pair<ll,ll>
ll INF = 1000000007;


/***************/
 #define amin main
/***************/

ll exp(ll x, ll n)
{if(n==0) return 1;if(n==1) return x%INF;if(n%2==0) return exp((x*x)%INF,n/2); else return(x*exp((x*x)%INF,n/2))%INF;}


int amin()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t,i;
	

ll a,b,c,d,e;
ll arr[5];

ll ans =0;
for(i=0;i<5;i++)
{
	cin>>arr[i];
	if(arr[i]==0)
		ans  = i+1;
}
cout<<ans<<endl;
	
	

	
	


	
	return 0;
}

Measured memory_bytes: 3604
nn=int(input())
n=10**5+100
ar=[0]*(n)
ar[1]=0
ans=0
pre=1
for i in range(2,int((n**0.5))+1):
    if ar[i]==0:

        for j in range(2*i,n,i):
            ar[j]=1
ans=1
if ar[nn]==0:
    print(nn)
else:
        
    for i in range(nn,n):
        if ar[i]==0:
            print(i)
            break
        

        

Measured memory_bytes: 3828
n,a,d,l=int(input()),list(map(int,input().split())),set(),0;b=[0]*n
for i in range(n-1,-1,-1):
  c=0
  for j in range(2*i+1,n,i+1):c=(c+b[j])%2
  if a[i]!=c:b[i]+=1;d.add(i+1);l+=1
print(l)
print(*[d.pop()for _ in range(l)])

Measured memory_bytes: 17184
import numpy as np
n,k=map(int,input().split())
h=np.array(list(map(int,input().split())),dtype=np.int64)
dp=np.full(n,10**10,dtype=np.int64)
dp[0]=0
for i in range(n-1):
  cost=np.abs(h[i]-h[i+1:i+k+1])
  np.minimum(dp[i+1:i+k+1],dp[i]+cost,out=dp[i+1:i+k+1])
print(dp[-1])

Measured memory_bytes: 22924
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

char X, Y;

int main () {
  cin >> X;
  cin.get();
  cin >> Y;

  if(X == Y) {
    cout << '=';
  } else if(X < Y) {
    cout << '<';
  } else {
    cout << '>';
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
readints()=parse.(Int,split(readline()))
function main()
	N=readints()[1]
    s=0
    ret="No"
    for i in 1:N
        D1,D2=readints()
        if D1==D2
            s+=1
            if s==3
                ret="Yes"
            end
        else
            s=0
        end
    end
    print(ret)
end
main()

Measured memory_bytes: 170120
package main
 
import (
  "fmt"
  "math"
)
 
func max(M *[]int) (ret int) {
  ret = (*M)[0]
  for _, m := range (*M) {
    if ret < m {
      ret = m
    }
  }
  return
}
 
func main() {
  var N, C int
  fmt.Scan(&N, &C)
  A := make([]int, N)
  B := make([]int, N)
  p := int(math.Pow(10, 9) + 7)
  var x int
  for i := 0; i < N; i++ {
    fmt.Scan(&x)
    A[i] = x
  }
  for i := 0; i < N; i++ {
    fmt.Scan(&x)
    B[i] = x
  }
  B_max := max(&B)
  X := make([][]int, C + 2)
  for i := 0; i < C + 2; i++ {
    X[i] = make([]int, B_max + 1)
  }
  for j := 1; j < B_max + 1; j++ {
    X[0][j] = 1
  }
  for i := 0; i < C + 1; i++ {
    for j := 1; j < B_max + 1; j++ {
      X[i + 1][j] = (X[i][j] * j) % p
      X[i][j] = (X[i][j] + X[i][j - 1]) % p
    }
  }
  DP := make([][]int, N + 1)
  for i := 0; i < N + 1; i++ {
    DP[i] = make([]int, C + 1)
  }
  DP[0][0] = 1
  var dp int
  for i := 1; i < N + 1; i++ {
    for j := 0; j < C + 1; j++ {
      for k := 0; k < j + 1; k++ {
        dp = X[k][B[i - 1]] - X[k][A[i - 1] - 1]
        if dp < 0 {
          dp += p
        }
        dp = (dp * DP[i - 1][j - k]) % p
        DP[i][j] += dp
      }
      DP[i][j] %= p
    }
  }
  fmt.Println(DP[N][C])
}

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

int hp[10005];

int func(int h, int a[],int b[],int n)
{
    if(h<=0)
    {
        return 0;
    }
    if(hp[h])
        return hp[h];
    int minPoints=INT_MAX;
    for(int i=0;i<n;i++)
    {
        int points=func(h-a[i],a,b,n)+b[i];
        minPoints=min(points,minPoints);
    }
    hp[h]=minPoints;
    return minPoints;
}


int main() {
    int h,n,a[1005],b[1005];
    cin>>h>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
    }
    
    cout<<func(h,a,b,n);
   
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
long long int gcd(long long int m,long long int n){
	if(n==0){
      return m;
    }
  return gcd(n,m%n);
}

long long int lcm(long long int number1,long long int number2){
	return number1 * number2 / gcd(number1,number2);	
}
int main(){
  long long int N;
  cin>>N;
  
  vector<long long int>a(N);
  
  for(long long int i=0;i<N;i++){
    cin>>a[i];   
  }
  long long int min=gcd(a[0],a[1]);
  for(int i=0;i<N;i++){
    if(gcd(min,a[i])<min){
      min=gcd(min,a[i]);
    }
  }
  
  
cout<<min<<endl;
}
  

Measured memory_bytes: 1024
#include <stdio.h>
int gcd(int a,int b)
{
   return b==0?a:gcd(b,a%b);
}
int main()
{
	int n;
	int e,d;
	int count=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			for(int k=1;k<=n;k++)
			{
				e=gcd(i,j);
				d=gcd(e,k);
				count+=d;
			}
		}
	}
	printf("%d\n",count);
}

Measured memory_bytes: 1700
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	for i := n; i <= 100003; i++ {
		p := true
		for j := 2; j*j <= i; j++ {
			if i%j == 0 {
				p = false
				break
			}
		}
		if p {
			fmt.Println(i)
			break
		}
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(void) {
    int N, M;
    string S;
    cin >> N >> M >> S;
    reverse(S.begin(), S.end());

    int now = 0;
    vector<int> ans;
    while(now != N) {
        bool flag = false;
        for(int i=M; i; i--) {
            if(now + i > N) continue;
            if(S[now+i] == '0') {
                now += i;
                ans.push_back(i);
                cerr << i << endl;
                flag = true;
                break;
            }
        }
        if(!flag) {
            cout << -1 << endl;
            return 0;
        }
    }

    reverse(ans.begin(), ans.end());
    for(auto e: ans) {
        cout << e << ' ';
    }
    return 0;
}


Measured memory_bytes: 1144
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
pre = -1

for target in A:
  ans += B[target-1]
  if(pre == -1):
    pre = target
    continue
  if(pre + 1 == target):
    ans += C[pre - 1]
  pre = target
print(ans)

Measured memory_bytes: 3064
def z_algorithm(s):  # O(|S|)
    """
    SとS[i:]のLCP(longest common prefix: 最長共通接頭辞の長さ) Z[i]を計算し、Zを返す
    """
    n = len(s)
    z = [0] * n
    z[0] = n
    i = 1
    j = 0
    while i < n:
        while i + j < n and s[j] == s[i + j]:
            j += 1
        z[i] = j
        if j == 0:
            i += 1
            continue
        k = 1
        while k < j and k + z[k] < j:
            z[i + k] = z[k]
            k += 1
        i += k
        j -= k
    return z

# ---------------------- #

n = int(input())
s = input()

ans = 0
for i in range(n):
    Z = z_algorithm(s[i:])
    for j in range(len(Z)):
        if Z[j] > j:
            ans = max(ans, j)
        else:
            ans = max(ans, Z[j])

print(ans)


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def build_grid(H, W, intv, _type, space=True, padding=False):
    # 入力がスペース区切りかどうか
    if space:
        _input = lambda: input().split()
    else:
        _input = lambda: input()
    _list = lambda: list(map(_type, _input()))
    # 余白の有無
    if padding:
        offset = 1
    else:
        offset = 0
    grid = list2d(H+offset*2, W+offset*2, intv)
    for i in range(offset, H+offset):
        row = _list()
        for j in range(offset, W+offset):
            grid[i][j] = row[j-offset]
    return grid

H, W, K = MAP()

grid = build_grid(H, W, '*', str, space=False, padding=True)

ans = list2d(H+2, W+2, -1)
cnt = 0
for i in range(1, H+1):
    if ''.join(grid[i]).count('#') == 0:
        ans[i] = ans[i-1]
        continue
    for j in range(1, W+1):
        if grid[i][j] == '#':
            cnt += 1
        ans[i][j] = cnt
    for j in range(W, 0, -1):
        if ans[i][j] == 0 or ans[i][j] == ans[i-1][W]:
            ans[i][j] = ans[i][j+1]

for i in range(H, 0, -1):
    if ans[i][1] == -1:
        ans[i] = ans[i+1]

for i in range(1, H+1):
    print(*ans[i][1:W+1])


Measured memory_bytes: 52700
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, a, n) for (int i = a; i <= (n); ++i)

using namespace std;
using ll = long long;

int main() {
    string S, T; cin >> S >> T;
    int A, B; cin >> A >> B;
    string U; cin >> U;

    if (U == S) A--;
    else B--;

    cout << A << " " << B << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000200, mod = 1'000'000'007;
int mul(long long a, long long b){
	return a * b % mod;
}
int f[maxn];
int main(){
	int n; cin >> n;
	f[1] = n;
	f[2] = mul(n, n);
	int sum = f[1] + f[2]; if(sum >= mod) sum -= mod;
	for(int i = 3; i <= n; i++){
		f[i] += sum;
		f[i] += mod - f[i - 2];
		if(f[i] >= mod) f[i] -= mod;
		f[i] += mul(n - 1, n - 1);
		if(f[i] >= mod) f[i] -= mod;
		f[i] += n - i + 2;
		if(f[i] >= mod) f[i] -= mod;
		sum += f[i];
		if(sum >= mod) sum -= mod;
	}
	cout << f[n] << endl;
	return 0;
}


Measured memory_bytes: 4352
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <map>


using namespace std;


int main()
{
  long a , b;
  cin >> a >> b;//１万から99999
  long ans=0;
  for(int i=a;i<=b;i++){
    if (i/10000 == i%10 && (i/1000)%10 == (i/10)%10 )ans++;
  }

  cout << ans << endl;


  return 0;
}

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

const int mod = 1e9+7;
long long int c[401][401];

long long int mypow(long long int a,long long int b){
	a%=mod;
	long long int res=1;
	while(b){
		if(b&1)	res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res;
}

long long int dp[401][401];
int A[401],B[401];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	for(int i=1;i<=400;i++)
		for(int j=0;j<=400;j++)
			c[i][j]=mypow(i,j);
	dp[0][0]=1;
	int n,C;
	cin>>n>>C;
	for(int i=1;i<=n;i++)
		cin>>A[i];
	for(int i=1;i<=n;i++)
		cin>>B[i];
	for(int i=1;i<=n;i++){
		for(int k=0;k<=C;k++){
			long long int tmp=0;
			for(int j=A[i];j<=B[i];j++)
				tmp+=c[j][k];
			tmp%=mod;
			for(int j=0;j+k<=C;j++)
				dp[i][j+k]=(dp[i][j+k]+dp[i-1][j]*tmp)%mod;
		}
	}
	cout<<dp[n][C]<<endl;
}


Measured memory_bytes: 2816
#include <iostream>
using namespace std;
int main(void){
    int h, w;
    cin >> h >> w;
    
    string board[50];
    
    for (int i = 0; i < h; ++i) cin >> board[i];
    
    const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
    const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
    
    for (int i = 0; i < h; ++i){
        for (int j = 0; j < w; ++j){
            if(board[i][j] == '#') continue;
            
            int num = 0;
            for(int d = 0; d < 8; ++d) {
                const int ni = i + dy[d];
                const int nj = j + dx[d];
                
                if(ni < 0 or h <= ni) continue;
                if(nj < 0 or w <= nj) continue;
                if(board[ni][nj] == '#') num++;
            }
            
            board[i][j] = char(num + '0');
        }
    }
    
    for(int i = 0; i < h; ++i) cout << board[i] << endl;
    
    return 0;
    
}

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

using namespace std;


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

    auto ans = 0, tmp = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'I') tmp++;
        else tmp--;
        ans = max(ans, tmp);
    }

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

Measured memory_bytes: 256
# ABC149b


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)

    a, b, k = map(int, input().split())
    nokori = k-(a-max(0, a-k))
    print(max(0, a-k), max(0, b-nokori))


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define INF 1e18
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N;
    cin >> N;
    vector<int> p(N);
    REP(i, N) cin >> p.at(i);
    int ans = 0;
    FOR(i, 1, N-1) {
        int minvalue = min({p.at(i-1), p.at(i), p.at(i+1)});
        int maxValue = max({p.at(i-1), p.at(i), p.at(i+1)});
        if ((p.at(i) > minvalue) && (p.at(i) < maxValue)) ans += 1;
    }
    print(ans);
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		n: usize,
		c: usize,
	}

	let mut tmax = 0;
	let mut v: Vec<Vec<usize>> = vec![vec![0; 100010]; c];
	for _i in 0..n {
		input! {
			s: usize,
			t: usize,
			c: usize,
		}
		tmax = max(tmax, t);
		for j in s-1..t {
			v[c-1][j] = 1;
		}
	}
	let mut ans = 0;
	for i in 0..tmax {
		let mut count = 0;
		for j in 0..c {
			count += v[j][i];
		}
		ans = max(ans, count);
	}
	println!("{}", ans);
}



Measured memory_bytes: 27180
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;

const long long mod = 1000000007;

long long power(long long a, long long b) {
  long long mult = a;
  long long ans = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      ans = (ans * mult) % mod;
    }
    mult = (mult * mult) % mod;
    b >>= 1;
  }
  return ans;
}

long long inv(long long n) {
  long long rest = mod - 2;
  return power(n, rest);
}

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

  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  vector<long long> weight(N);
  weight[0] = 0;
  for (int i = 1; i < N; i++) {
    weight[i] = (weight[i - 1] + inv(i + 1)) % mod;
  }

  long long ans = 0;
  for (int i = 0; i < N; i++) {
    ans = (ans + A[i] * (1 + weight[N - i - 1] + weight[i])) % mod;
  }

  for (int i = 0; i < N; i++) {
    ans = (ans * (i + 1)) % mod;
  }

  cout << ans << endl;

  return 0;
}

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

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

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

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

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

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

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

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

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

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

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

// 数xがn桁で、各桁の和をsとする
// 1) 2数の和が < 10
//    - 桁が減る
//    - 和は変わらない
// 2) 2数の和が >= 10
//    - 桁は変わらない
//    - 和は9減る
// 最終的に、
//    - (n-1)+(s-1)/9 回できて、
//    - s-(s-1)/9*9になる

int main(int argc, char** argv) {
  int M;
  cin >> M;
  vi D(M);
  vll C(M);
  REP(i, M) {
    cin >> D[i] >> C[i];
  }

  ll s = 0;
  ll n = 0;
  REP(i, M) {
    s += D[i]*C[i];
    n += C[i];
  }

  ll a = (s-1)/9;
  ll ret = (n-1) + a;
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 2560
n,m=[int(i) for i in input().split()]
pp=[[0 for i in range(2)] for j in range(m)]
not_bridge=0

#深さ優先探索-------------------------------------------------------------
#参照元：Python3でグラフの実装＆深さ優先探索・幅優先探索の実装
#http://muromura.hatenablog.com/entry/2017/07/16/025414
def dfs(Graph, Start, Vn, Visited=None):
  
##追加（空から読んでも動くように修正）-----------------------
  if Graph[Start]==[] and Visited==None: 
        Next=Start+1        
        dfs(Graph, Next, Vn, Visited)  #再帰
  else:
##--------------------------------------------------------

    if (Visited==None):  Visited = [] #開始点のときに探索済みリストをつくる
    Visited.append(Start)  #現在の頂点を探索済みリストに加える
#    print(Start, "\n", Visited)  #現在の頂点と探索済みリストを表示
    if len(Visited)==Vn: #全点訪問済みの場合、橋ではない
        global not_bridge
        not_bridge=not_bridge+1
    for Next in Graph[Start]:  #次に探索する頂点の候補
        if ( Next in Visited ):  continue  #訪問済みリストにある頂点は飛ばす
        dfs(Graph, Next, Vn, Visited)  #再帰
#-----------------------------------------------------------------------        

for i in range(m) :
    pp[i] =[int(i) for i in input().split()]

for i in range(m) : #辺を１つ削除してその辺が橋かどうかを深さ優先探索で調べる
    p=pp[:]
    del p[i]

#隣接リスト
    l = [[] for i in range(n+1)] #頂点の数+1
    for pi in p:  #0-originedに注意、l[0]は空
        l[pi[0]].append(pi[1])
        l[pi[1]].append(pi[0])

    
    #頂点０（１）から探索
    dfs(l, 0, n)
    
print(m-not_bridge)

Measured memory_bytes: 3064
#include <cstdio>

int main() {
  //入力
  int a,b,c;
  std::scanf("%d %d %d",&a,&b,&c);
  
  if (a < b && b < c) {
    std::printf("Yes\n");
  }
  else {
    std::printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 2580
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const double PI = acos(-1.0);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int H,W; cin >> H >> W;
    vector<vector<int>> S(H, vector<int>(W));
    rep(i,H) rep(j,W) cin >> S[i][j];

    vector<vector<int>> A(H, vector<int>(W));
    rep(i,H) {
        rep(j,W) {
            if (i) {
                if (S[i][j]) A[i][j] = 0;
                else A[i][j] = A[i-1][j]+1;
            } else {
                A[i][j] = 1-S[i][j];
            }
        }
    } 

    int ans = 0;
    rep(i,H) {
        stack<pii> sta;
        sta.emplace(0,-1);
        rep(j,W) {
            int w = j;
            while (sta.top().first > A[i][j]) {
                int h,left;
                tie(h,left) = sta.top(); sta.pop();
                chmax(ans, h*(j - left));
                w = left;
            }
            if (sta.top().first < A[i][j]) {
                sta.emplace(A[i][j],w);
            }
        }
        while (!sta.empty()) {
            int h,left;
            tie(h,left) = sta.top(); sta.pop();
            chmax(ans, h*(W - left));
        }
    }

    cout << ans << ln;
}


Measured memory_bytes: 18380
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int n = sc.nextInt();
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();

		}
		int c[][] = new int[h][w];
		int now = 0;
		for (int i = 0; i < h; i++) {
			for (int o = 0; o < w; o++) {
				c[i][o] = now + 1;
				a[now]--;
				if (a[now] == 0) {
					now++;
				}

			}
		}
		for (int i = 0; i < h; i++) {
			if (i % 2 == 0) {


				for (int o = 0; o < w; o++) {
					System.out.print(c[i][o]);

				if(o!=w-1){
					System.out.print(" ");
				}}
			} else {

				for (int o = w - 1; o >= 0; o--) {
					System.out.print(c[i][o]);
					if(o!=0){
						System.out.print(" ");
					}
				}
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 31024
#include<bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
#define fi first
#define se second
#define debug(x) cout << #x" = " << x << endl;
#define pp(x,y) cout << "pp: " << x << " " << y << endl;
namespace IO{
	const int L=1<<15;char ibuf[L|1],*iS=ibuf,*iT=ibuf,obuf[L|1],*oS=obuf,*oT=obuf+L,c,st[66];int tp=0,f;
	inline char gc(){if(iS==iT) iT=(iS=ibuf)+fread(ibuf,sizeof(char),L,stdin);return (*iS++);}
	inline void flush(){fwrite(obuf,sizeof(char),oS-obuf,stdout);oS = obuf;}
	inline void pc(char c){*oS++=c;if(oS==oT) flush();}
	#define gc getchar
	#define pc putchar
	inline ll read(){ll x=0;f=1,c=gc();for(;!isdigit(c);c=gc())if(c=='-')f=-1;for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c&15);return x*f;}
	inline void write(ll x){if(!x) pc('0');if(x<0) pc('-'),x=-x;while(x) st[++tp]=x%10+'0',x/=10;while(tp) pc(st[tp--]);}
	inline void writeln(ll x){write(x);pc('\n');}
	inline void wri(ll x){write(x),pc(' ');}
	struct IOflusher{~IOflusher(){flush();}}_ioflusher_;
}using IO::read;using IO::write;using IO::writeln;using IO::wri;//using IO::gc;using IO::pc;
int n;
vector<pair<ll,ll> > v;
ll ans[100010];
int main(){
	n = read();
	Rep(i,1,n) v.push_back({read(),i});
	sort(v.begin(),v.end());reverse(v.begin(),v.end());
	v.push_back({0,1e9});
	ll mn=1e9;
	rep(i,0,n){
		mn=min(mn,v[i].se);
		ans[mn] += (i+1) * (v[i].fi-v[i+1].fi);
	}
	Rep(i,1,n) writeln(ans[i]);
	return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
const int MAX = 2e5+5;

int main(int argc, char** argv) {
	int N;
	string s;
	map<string, int> mp;
	mp["AC"] = mp["WA"] = 0;
	mp["TLE"] = mp["RE"] = 0;
	cin >> N;
	rep(i, 0, N)
		cin >> s, mp[s]++;
	cout << "AC x " << mp["AC"] << "\n";
	cout << "WA x " << mp["WA"] << "\n";
	cout << "TLE x " << mp["TLE"] << "\n";
	cout << "RE x " << mp["RE"] << "\n";
	
	return 0;
}


Measured memory_bytes: 3628
MOD = 10 ** 9 + 7

def eratosthnes(n)
  n = (n ** 0.5).to_i
  prime = []
  search = Array.new(n+1,true)
  2.upto(n) do |i|
    if search[i]
      prime << i
      m = i ** 2
      until m > n
        search[m] = false
        m += i
      end
    end
  end
  return prime
end

def fact(n)
  @cache ||= []
  @cache[n] ||= (n==0) ? 1 : (n * fact(n-1)) % MOD;
end

def pow(x,n)
  ret = 1
  while n > 0
    ret = (ret * x) % MOD if n&1 == 1
    n >>= 1
    x = (x*x) % MOD
  end
  return ret
end

def combin(n,k)
  ret = (fact(n) * pow(fact(n-k),MOD-2)) % MOD
  return (ret * pow(fact(k),MOD-2)) % MOD
end

n,m = gets.split.map(&:to_i)

n.times do |i|
  fact(i)
end
prime = eratosthnes(m)

exp = []
prime.each do |k|
  e = 0
  while m % k == 0
    m /= k
    e += 1
  end
  exp << e if e != 0
end
exp << 1 if m != 1

ans = 1
exp.each do |k|
  ans = (ans * combin(n+k-1,k)) % MOD
end
p ans

Measured memory_bytes: 4936
#include <iostream>
#include<vector>
using namespace std;
vector<int>adj[100001];
vector<int>dp;
vector<int>vis;
int dfs(int i){
	if (vis[i]) return dp[i];
	vis[i] = 1;
	dp[i] = 0;
	for (auto x:adj[i]){
		dp[i] = max(dp[i],dfs(x)+1);
	}
	return dp[i];
}

int main() {
	int n,m;
	cin>>n>>m;
	dp.resize(n);
	vis.resize(n);
	for (int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--,b--;
		adj[a].push_back(b);
	}
	int ans = 0;
	for (int i=0;i<n;i++){
		ans = max(ans,dfs(i));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 11352
let input = require('fs').readFileSync('/dev/stdin', 'UTF-8');
let arr = input.split('\n');

for (let I = 0; I < arr.length; I++) {
  let n = arr[I].split(' ').map(Number)[0]
  let x = arr[I].split(' ').map(Number)[1]
  if (n === 0 && x === 0) break;
  let cnt= 0;
  for (let i = 1; i <= n; i++) {
    for (let j = i + 1; j <= n; j++) {
      if (i + j >= x) break;
      let k = x - (i + j);
      if (k > j && k <= n) cnt++;
    }
  }
  console.log(cnt)
}


Measured memory_bytes: 17156
N = int(input())
X = []
Y = []
for i in range(N):
    x,y = map(int,input().split())
    X += [x]
    Y += [y]
L = 0 
for i in range(N-1):
    for j in range(i+1,N):
        L += (((X[i] - X[j]) ** 2 ) + ((Y[i] - Y[j] ) ** 2 ) ) ** 0.5 
        
print(L*2/N)

Measured memory_bytes: 3188