akhauriyash/Code-Regression huggingface dataset:
package scc;
sub new{
	return bless[map[],1..$_[1]],$_[0];
}
sub add_edge{
	my$self=shift;
	push@{$self->[$_[0]]},$_[1];
}
sub scc{
	my$self=shift;
	my$now_ord=0,$group_num=0,@low,@ord=(-1)x@{$self},@ids;
	my@visited;
	my$dfs;
	$dfs=sub{
		my$v=shift;
		$low[$v]=$ord[$v]=$now_ord++;
		push@visited,$v;
		for$to(@{$self->[$v]}){
			if($ord[$to]==-1){
				$dfs->($to);
				$low[$v]=$low[$to]if$low[$v]>$low[$to];
			}
			else{
				$low[$v]=$ord[$to]if$low[$v]>$ord[$to];
			}
		}
		if($low[$v]==$ord[$v]){
			my$u=-1;
			while($u!=$v){
				$u=pop@visited;
				$ord[$u]=@{$self};
				$ids[$u]=$group_num;
			}
			$group_num++;
		}
	};
	for$i(0..$#ord){
		$dfs->($i)if$ord[$i]==-1;
	}
	$_=$group_num-1-$_ for@ids;
	@groups=map[],1..$group_num;
	for$i(0..$#ids){
		push@{$groups[$ids[$i]]},$i;
	}
	return\@groups;
}
package main;
my($N,$M)=split$",<>;
my$scc=scc->new($N);
for(1..$M){
	my($a,$b)=split$",<>;
	$scc->add_edge($a,$b);
}
$groups=$scc->scc();
print scalar(@{$groups}),$/;
for$L(@{$groups}){
	print scalar(@{$L}),$","@{$L}",$/;
}


Measured memory_bytes: 289896
def main():
    N = int(input())
    ab = [[int(i) for i in input().split()] for _ in range(N)]
    ab.sort(key=lambda p:p[1])
    t = 0
    for a,b in ab:
        t += a
        if t > b:
            print("No")
            break
    else:
        print("Yes")
if __name__ == "__main__":
    main()

Measured memory_bytes: 88228
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
typedef long long ll;
using namespace std;
const int MOD=1e9+7;
ll N;
ll x[100000];
int main(void) {
	cin >> N;
	ll ans = N;
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}
	sort(x, x + N);
	int mae = -1;
	for (int i = 0; i < N; i++) {
		if (x[i] == mae) {
			ans = ans - 2;
			mae = -1;
		}
		else {
			mae = x[i];
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <queue>
#include <map>

using namespace std;

int main() {
    
    
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> p[i];
    }
    int ret = 0;
    for (int i = 1; i < n - 1; ++i)
    {
        if ((p[i] > p[i - 1] && p[i] < p[i + 1]) || (p[i] < p[i - 1] && p[i] > p[i + 1]))
        {
            ret++;
        }
    }
    
    cout << ret << endl;
    
    return 0;
}

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

int main(){
  vector <vector<int> > dp;
  string x,y;
  int n;

  cin >> n;
  for(int times=0;times<n;times++){
    int ans =0;

    cin >> x >> y;
    dp.resize(y.size()+1);
    for(int i=0;i<=y.size();i++){
      dp[i].resize(x.size()+1);
    }

    for(int i=0;i<=y.size();i++){
      dp[i][0]=0;
    }
    for(int i=0;i<=x.size();i++){
      dp[0][i]=0;
    }

    for(int i=1;i<=y.size();i++){
      for(int j=1;j<=x.size();j++){
        if(x[j-1]==y[i-1]){
          dp[i][j] = dp[i-1][j-1]+1;
        }else{
          dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
	ans = max(ans,dp[i][j]);
      }
    }

    cout << ans << endl;
  }
}


Measured memory_bytes: 6924
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

template<class T> inline int sgn(T n) { if (n > 0) return 1; else if (n < 0) return -1; else return 0; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;

  int n = sz(s);

  string t;
  string tmp;
  for (int i = n-1; i >= 0; --i) {
    tmp = s[i] + tmp;
    if (tmp == "dream" || tmp == "dreamer" || tmp == "erase" || tmp == "eraser") {
      t = tmp + t;
      tmp = "";
    }
  }

  puts(s==t ? "YES" : "NO");
 }


Measured memory_bytes: 744
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#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 _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int N = in();
  vector<pair<ll,ll>> task(N);
  rep(i,N){
    ll A, B;
    cin >> A >> B;
    task[i].first = B;
    task[i].second = A;
  }
  sort(all(task));
  bool ans = true;
  ll t = 0;  // current time
  rep(i,N){
    ll A = task[i].second;
    ll B = task[i].first;
    if(B<A){
      ans = false;
      break;
    }
    t += A;
    if(t>B){
      ans = false;
      break;
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3456
#include <iostream>

using namespace std;

int main() {
    int i, a, b, c;
    cin >> a >> b;
    for (i=1; a!=0 || b!=0; i++)
    {
        if (a > b)
        {
            c=b;
            b=a;
            a=c;
        }
        cout << a << " " << b << endl;
        cin >> a >> b;
    }
}


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

class Program
{
    private static int i = 0;
    private static List<int> l = null;

    static void Main()
    {
        string s = Console.ReadLine();
        int sz = s.Length;

        l = new List<int>();

        while(i < sz)
        {
            if (s[i] == '_' || s[i] == '/') 
            {
                // 平面、上りは次の文字列へ
                i++;
                continue;
            }
            else if (s[i] == '\\')
            {
                Pool(s, sz);
            }
        }

        int sum = 0;
        string ret = "";

        foreach (int n in l)
        {
            sum += n;
            ret = ret + n.ToString() + " ";
        }

        Console.WriteLine(sum);

        if (l.Count == 0) 
            ret = l.Count.ToString();
        else
            ret = string.Format("{0} {1}", l.Count, ret.TrimEnd());

        Console.WriteLine(ret);
    }

    static void Pool(string s, int sz)
    {        
        int j = 0;

        int down = 0;
        int up = 0;
        bool f;

        while (i < sz)
        {
            j = i;
            f = false;

            // 下りカウント
            while (j < sz)
            {
                if (s[j] == '\\')
                {
                    down++;
                    j++;
                }
                else
                    break;
            }

            // 高さが同じになるまでカウント
            while (j < sz)
            {
                     if (s[j] == '/')  up++;
                else if (s[j] == '\\') up--;
                // 平面は何もしない

                if (down == up && (down + up) != 0)
                {
                    // 計算
                    l.Add(Calc(s, i, j));

                    i = j;
                    f = true;
                    break;
                }

                j++;
            }

            if (f) break;

            up = 0;
            down = 0;
            i++;
        }
    }

    static int Calc(string s, int st, int ed)
    {
        int tmp = st;
        int h = 0;
        double m = 0;

        while (st <= ed)
        {
            if (s[st] == '\\')
            {
                if (tmp != st && s[st-1] == '\\')
                    h++;
            }
            else if (s[st] == '/')
            {
                if (s[st-1] != '\\')
                    h--;
            }
            else if (s[st] == '_')
            {
                if (s[st-1] == '\\')
                    h++;
            }

            if (s[st] == '\\' || s[st] == '/')
                m += (0.5 + h);
            else
                m += h;

            st++;
        }

        return (int)m;
    }
}


Measured memory_bytes: 9600
# https://atcoder.jp/contests/abc109/tasks/abc109_b


N = gets.to_i
Ws = Array.new(N) { gets.chomp }

c2 = Ws.uniq.size == N
c1 = Ws.each_cons(2).all? { |w1, w2| w1[-1] == w2[0] }

puts c1 && c2 ? 'Yes' : 'No'


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define int long long
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
class SegTree {
public:
  int n;
  VI dat;
  const int INITIAL = 0;
  SegTree(int n_) {
    n = 1;
    while (n < n_) { n *= 2; }
    dat = VI(2*n-1, INITIAL);
  }
  // k番目をaに
  void update(int k, int a) {
    k += n - 1;
    dat[k] = a;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = dat[2*k+1] + dat[2*k+2];
    }
  }
  // k番目のノードの[l, r)について[a, b)を求める
  int query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) { return 0; }
    if (a <= l && r <= b) { return dat[k]; }
    int vl = query(a, b, k*2+1, l, (l+r)/2);
    int vr = query(a, b, k*2+2, (l+r)/2, r);
    return vl + vr;
  }
  int query(int a, int b) {
    return query(a, b, 0, 0, n);
  }
};

int N;
VI a;
map<int, int> trans;
int K;
VI rev;

// 中央値がx以下になる数列のとり方
int count(int x_) {
  int x = rev[x_];
  VI acc(N+1, 0);
  int K2 = 0;
  map<int, int> trans2;
  trans2[0] = 1;
  REP (i, N) {
    if (a[i] <= x) {
      acc[i+1] = acc[i] - 1;
    } else {
      acc[i+1] = acc[i] + 1;
    }
    trans2[acc[i+1]] = 1;
  }
  for (auto& p: trans2) {
    p.second = K2++;
  }
  SegTree seg(K2);
  int ans = 0;
  REP (i, N+1) {
    int t = trans2[acc[i]];
    ans += seg.query(t+1, K);
    seg.update(t, seg.query(t, t+1) + 1);
  }
  return ans;
}

void solve() {
  int l = 0;
  int r = K - 1;
  int mid = (l + r) / 2;
  while (l < r) {
    /* cout << "l: " << l << "mid: " << mid << " r: " << r << endl; */
    int num = count(mid);
    if (num < N * (N + 1) / 4 + 1) {
      l = mid + 1;
    } else if (num > N * (N + 1) / 4 + 1) {
      r = mid;
    }
    mid = (l + r) / 2;
  }
  cout << rev[mid] << endl;
}

signed main() {
  cin >> N;
  a.resize(N);
  REP (i, N) {
    cin >> a[i];
    trans[a[i]]++;
  }
  for (auto& p: trans) {
    rev.push_back(p.first);
    p.second = K++;
  }
  solve();
}


Measured memory_bytes: 15588
#include <iostream>
#include<string>
using namespace std;
int a,b,c;
int main() {
	cin>>a>>b>>c;
	if(a==5&&b==5&&c==7||a==5&&b==7&&c==5||a==7&&b==5&&c==5){cout<<"YES"<<endl;}else cout<<"NO"<<endl;
	return 0;
}

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

int main()
{
	int p[3] = { 1, 0, 0 };
	string str;
	while (cin >> str)
	{
		int a = str[0]-'A', b = str[2]-'A';
		int tmp = p[a];
		p[a] = p[b];
		p[b] = tmp;
	}

	for (int i=0; i<3; i++)
		if (p[i]) cout << (char) ('A'+i) << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(150) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  //[0,N),[N,2N),[2N,3N)
  Vec(P,lli,3*N,0);
  rep(i,0,3*N)cin >> P[i];
  Sort(P);
  rep(i,N,3*N){num+=P[i];i++;}
  Out(num);
}


Measured memory_bytes: 2560
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

type town struct {
	x, y, p int
}

const inf = int(1e15)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N := getInt()
	X := make([]int, N)
	Y := make([]int, N)
	P := make([]int, N)
	for i := 0; i < N; i++ {
		X[i], Y[i], P[i] = getInt(), getInt(), getInt()
	}

	dist := make([]int, N+1)
	n := 1
	for i := 0; i < N; i++ {
		n *= 3
		dist[i] = inf
	}

	lx := make([]int, 0, N)
	ly := make([]int, 0, N)
	l := make([]int, 0, N)

	for i := 0; i < n; i++ {
		// if i%100000 == 0 {
		// 	out(i)
		// }
		lx = lx[:0]
		ly = ly[:0]
		l = l[:0]
		p := i
		for j := 0; j < N; j++ {
			switch p % 3 {
			case 0: // nothing
				l = append(l, j)
			case 1: // add x
				lx = append(lx, X[j])
			case 2: // add y
				ly = append(ly, Y[j])
			}
			p /= 3
		}
		sum := 0
		for _, x := range l {
			d := min(abs(X[x]), abs(Y[x]))
			for _, px := range lx {
				d = min(d, abs(px-X[x]))
			}
			for _, py := range ly {
				d = min(d, abs(py-Y[x]))
			}
			sum += d * P[x]
		}
		pos := len(lx) + len(ly)
		dist[pos] = min(dist[pos], sum)
	}
	for i := 0; i <= N; i++ {
		out(dist[i])
	}
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  int P,R,Q,a;
  cin >> P >> R >> Q;
  a = min({P+R,R+Q,P+Q});
  if(a == P+R){
    cout << a << endl;
  }
  else if(a == R+Q){
    cout << a << endl;
  }
  else if(a == P+Q){
    cout << a << endl;
  }
}

Measured memory_bytes: 256
"""Binary Trees."""

class Node:
    def __init__(self, num, leftChild, rightChild):
        self.id = num
        self.parent = -1
        self.sibling = -1
        self.degree = 0
        self.depth = 0
        self.height = 0
        self.type = 'leaf'
        self.leftChild = leftChild
        self.rightChild = rightChild
        
    def show_info(self):
        print('node {}:'.format(self.id), 'parent = {},'.format(self.parent),
              'sibling = {},'.format(self.sibling),
              'degree = {},'.format(self.degree),
              'depth = {},'.format(self.depth),
              'height = {},'.format(self.height),
              '{}'.format(self.type))


def set_attributes(n_i, parent, sibling, depth):
    h1 = 0
    h2 = 0
    node = T[n_i]
    lc = node.leftChild
    rc = node.rightChild
    node.parent = parent
    node.sibling = sibling
    node.depth = depth
    if lc != -1:
        node.degree += 1
        node.type = 'internal node'
        h1 = set_attributes(lc, n_i, rc, depth + 1) + 1
    if rc != -1:
        node.degree += 1
        node.type = 'internal node'
        h2 = set_attributes(rc, n_i, lc, depth + 1) + 1
    node.height = max(h1, h2)
    return node.height



import sys

n = int(sys.stdin.readline())

T = [None] * n

rt_n = int(n * (n - 1) / 2)

for x in sys.stdin.readlines():
    num, leftChild, rightChild = list(map(int, x.split()))
    node = Node(num, leftChild, rightChild)
    T[num] = node
    rt_n -= (max(0, leftChild) + max(0, rightChild))

set_attributes(rt_n, -1, -1, 0)

T[rt_n].type = 'root'

for n in T:
    n.show_info()

Measured memory_bytes: 7836
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>

long long PRIME = 1e9 + 7;
using namespace std;

int main(){
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    cout << 'A' << s2[0] << 'C';
}



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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    Ans(a<=c && c<=b);
    return 0;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int i = 0, j = k;
    while (j <= n-1) {
        if (a[i] >= a[j]) cout << "No" << endl;
        else cout << "Yes" << endl;
        i++;
        j++;
    }
}

Measured memory_bytes: 4008
import java.util.*;
import java.io.*;
import java.math.*;
class Main{
	static int mod = (int)1e9+7;
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static void main(String sp[])throws IOException{
		FastReader sc = new FastReader();
		
		int n = sc.nextInt();
		int arr[] = new int[n-1];
		
		for(int i=0;i<n-1;i++)
			arr[i]=sc.nextInt();
		
		int ai[] = new int[n];
		Arrays.fill(ai,0);
		
		ai[0]=arr[0];
		ai[n-1] = arr[n-2];
		
		for(int i=1;i<n-1;i++){
			if(arr[i-1]<=arr[i])
				ai[i]=arr[i-1];
			else ai[i]=arr[i];
		}
		long total=0;
		for(int i=0;i<n;i++)
			total+=ai[i];
		
		System.out.println(total);
		
	}
	
	
	
	
	
	//static HashMap<Integer,Integer> visited = new HashMap<>();
		
	
	/*public static int compute(int root, int n, int m, Tree[] edge, int values[]){
			
			LinkedList<Integer> ll = 	new LinkedList<>();
			ll.add(root);
				
			while(ll.size()>0){
				int val = ll.removeFirst();
				visited.put(val,0);
				ArrayList<Integer> al = edge[val].al;
				int length = al.size();
				for(int i=0;i<length;i++){
					ll.addLast(al.get(i));
					int hold = edge[val].weight+values[root];
					values[al.get(i)] = Math.min(hold,values[al.get(i)]);
				}
			}
			return values[n];
			
	}*/
	
	
	public static class Tree{
		int weight;
		int destination;
	}
	
	
	
	public static int partition(int [] arr, int s, int e){
		
		int index=s;
		int pivot = arr[e];
		for(int i=s;i<=e-1;i++){
			if(arr[i]<=pivot){
				arr = swap(arr, index, i);
				index++;
			}
		}
		swap(arr,index,e);
		print(arr);
		return index;
	}
	
	public static int[] swap(int[] arr, int low, int high){
		int temp = arr[low];
		arr[low]=arr[high];
		arr[high]=temp;
		return arr;
	}
	
	
	public static long gcd(long a, long b){
		if(a==0)
			return b;
		
		return gcd(b%a,a);
	}
	
	public static void print(int[] arr){
		for(int i=0;i<arr.length;i++)
			System.out.print(arr[i]+" ");
		System.out.println();
	}
	
	public static class pair{
		int ai;
		int bi;
	}
	
	public static class comp implements Comparator<pair>{
		public int compare(pair o1, pair o2){
			return o1.bi-o2.bi;
		}
	}
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
}

Measured memory_bytes: 21460
# coding: utf-8
s=input()
stk=[]
data=[]
for i in range(len(s)):
    if s[i]=='\\':
        stk.append(i)
    elif s[i]=='/':
        if len(stk):
            data.append((stk.pop(),i))
print(sum(map(lambda x:x[1]-x[0],data)))
ans=[]
sv=-1
for p in data[::-1]:
    if sv==-1:
        sv=p
        ans.append(p[1]-p[0])
    elif sv[0]<p[0]<p[1]<sv[1]:
        ans[-1]+=p[1]-p[0]
    else:
        sv=p
        ans.append(p[1]-p[0])
print(len(ans[::-1]),end=' ' if len(ans[::-1])!=0 else '')
print(*ans[::-1])


Measured memory_bytes: 6852
#include<iostream>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;

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

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

using namespace std;
int main(void){
  string s, t;
  cin >> s >> t;
  
  int cnt = 0;
  
  int n = (int)s.size();
  
  for (int i = 0; i < n; i++){
      if (s[i] != t[i]) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3860
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll n,a[5]={};
int main(void) {
    cin >> n>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
    ll min_a=a[0];
    ll min_n=0;
    rep(i,5){
        if(min_a>a[i]){
            min_a=a[i];
            min_n=i;
        }
    }
    cout << n/min_a+4+ll(n%min_a!=0) << endl;

    return 0;
}


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

int A,B,C;
int haseql(int t)
{
    return (t==A) + (t == B) +(t == C);
}
int main()
{
    cin>>A>>B>>C;
    int t = A ^ B^C;
    if(haseql(t)==1)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	int N=sc.nextInt();
	int[] H=new int[N];
	for(int i=0;i<N;i++) {
		H[i]=sc.nextInt();
	}
	sc.close();

	for(int i=N-1;i>0;i--) {
		if(H[i]==H[i-1]-1) {
			H[i-1]--;
		}else if(H[i]<H[i-1]-1) {
			System.out.println("No");
			System.exit(0);
		}
	}
	System.out.println("Yes");


}
}


Measured memory_bytes: 51160
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    int ok = 1;
    if(S[0] != 'A')
        ok = 0;
    int C = 0;
    for(int i = 2; i < S.size() - 1; i++) {
        if(!C && S[i] == 'C') {
            C = 1;
        } else if(C && S[i] == 'C')
            ok = 0;
    }
    if(C == 0)
        ok = 0;
    sort(All(S));
    for(int i = 2; i < S.size(); i++) {
        if(S[i] <= 'Z')
            ok = 0;
    }
    cout << (ok ? "AC" : "WA") << endl;
    return 0;
}

Measured memory_bytes: 256
//Radhe Radhe
#include<bits/stdc++.h>
#define ll long long
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
using namespace std;

int main()
{
    fast_io
    ll i,t,n,j,k,sum=0,cpn;
    string s;
    cin>>n;
    cpn=n;
    while(n>0)
    {
        sum+=n%10;
        n/=10;
    }


    if(cpn%sum==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}





Measured memory_bytes: 3532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;


int main(){
  int h, w, d;
  unordered_map<int, P> mp;
  int q;
  int dp[90001];
  int ans = 0;
  cin >> h >> w >> d;
  rep(i, h){
    rep(j, w){
      int a;
      cin >> a;
      mp[a] = P(i, j);
    }
  }
  
  for(int i = d+1; i <= h*w; i++){
    dp[i] = dp[i-d] + abs(mp[i].first-mp[i-d].first) + abs(mp[i].second-mp[i-d].second);
  }
  cin >> q;
  while(q--){
    int l, r;
    cin >> l >> r;
    cout << dp[r] - dp[l] <<endl;
  }
}
        
        



Measured memory_bytes: 5412
#include <cstdio>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <limits>
using namespace std;
using i8t = std::int64_t;
using vi8t = std::vector<i8t>;
using vvi8t = std::vector<std::vector<i8t>>;
static const i8t i8t_max=numeric_limits<i8t>::max();
static const i8t i8t_min=numeric_limits<i8t>::min();
using u8t = std::uint64_t;
using vu8t = std::vector<u8t>;
#define F3(I,A,B) for(i8t I=A,I##_N=B;I<I##_N;I++)
#define F(I,N) F3(I,0,N)
#define FR(I,N) for(i8t I=N;I--;)
#define R(V) i8t V;std::cin>>V;
#define RV(V,N) std::vector<i8t> V;F(_i,N){R(_x)V.push_back(_x);}
#define RL1(line) std::getline(std::cin,line);
#define RL(line) std::string line;RL1(line)
#define RM(V,L,C) std::vector<char> V;F(_i,L){RL(_l)F(_j,C)V.push_back(_l[_j]);}
#define P(X) std::cout<<(X)<<std::endl;
template<typename T> T umax(T& ans,T const& value) {if(value>ans)ans=value;return ans;}
template<typename T> T umin(T& ans,T const& value) {if(value<ans)ans=value;return ans;}

std::vector<std::pair<u8t,u8t>> prime_multifactors(u8t value){
  std::vector<std::pair<u8t,u8t>> factors;
  if(value==0){factors.emplace_back(0,1);return factors;}
  auto _reduce = [&](auto f){
    if(value%f)return;
    value/=f;factors.emplace_back(f,1);
    while(value%f==0){value/=f;factors.back().second++;}
  };
  _reduce(2);
  _reduce(3);
  for (i8t i=5;i*i<=value;i+=6){
    if(i*i>value)break;
    _reduce(i);
    _reduce(i+2);
  }
  if(value!=1)factors.emplace_back(value,1);
  return factors;
}

vu8t prime_divisors(u8t value){
  auto facm = prime_multifactors(value);
  vi8t ind(facm.size()+1,0);
  int depth=0;
  u8t K=1;
  vu8t divisors;
  while (1){
    if(depth<facm.size()&&ind[depth]<=facm[depth].second){
      depth++;
    }else{
      if(depth==facm.size()){
        divisors.push_back(K);
      }

      do{
        while(ind[depth]){
          K/=facm[depth].first;
          ind[depth]--;
        }
        depth--;
        if(depth<0)return divisors;
      }while(ind[depth]==facm[depth].second);

      ind[depth]++;
      K*=facm[depth].first;
    }
  }
}

//-----------------------------------------------------------------------------

bool test1(i8t N,i8t K){
  while(N&&N%K==0)N/=K;
  return N%K==1;
}

int main() {
  R(N);
  i8t ans=prime_divisors(N-1).size()-1;
  for(auto K:prime_divisors(N)){
    if(K==1)continue;
    if(test1(N,K))ans++;
  }
  P(ans);
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
using namespace std;

typedef long long ll;
ll MOD = 1e9+7;


int main()
{
	ll n;
	ll ans=0;
	cin>>n;
	for(ll i=1;i<sqrt(n)+1;i++)
	{
		if(n%i!=0)
			continue;
		ll tmp=n/i-1;
		if(tmp>i && tmp<n)
			ans+=tmp;
	}
	cout<<ans<<endl;
	return 0;
}

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

using P = pair<int,int>;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)


struct UnionFind {
    vector<int> data;
    UnionFind(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};


int main() {
    int n, k, l;
    cin>>n>>k>>l;
    UnionFind uf1(n), uf2(n);

    rep(i,k){
        int p, q;
        scanf("%d%d",&p,&q);
        --p; --q;
        uf1.unionSet(p,q);
    }
    rep(i,l){
        int p, q;
        scanf("%d%d",&p,&q);
        --p; --q;
        uf2.unionSet(p,q);
    }

    map<P, int> mp;
    rep(i,n) {
        ++mp[P(uf1.root(i), uf2.root(i))];
    }
    rep(i,n){
        int x = mp[P(uf1.root(i), uf2.root(i))];
        cout << x;
        cout << (i == n-1 ? "\n" : " ");
    }

    return 0;
}

Measured memory_bytes: 13568
import math
N,K = (int(x) for x in input().split())
R = N - K
mod = 10**9 + 7

def fact(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
  if N - K + 1 < i:
    ans = 0
  else:
    ans = fact(R+1, i)*fact(K-1,i-1)
  print(int(ans)%mod)

  


Measured memory_bytes: 3316
from collections import Counter

S = input()
S1 = S

st = set(S)
rlt = 1000

if len(Counter(st)) == 1:
  print(0)
  exit()
  
for s in st:
  S = S1
  t = 0
  while len(Counter(S)) > 1:
    tmp = ''
    for i in range(1,len(S)):
      if S[i-1] == s or S[i] == s:
        tmp += s
      else:
        tmp += S[i]
    t += 1
    S = tmp

  if t < rlt:
    rlt = t
    
print(rlt)

Measured memory_bytes: 43240
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
  long long k;
  cin>>k;
  long long n;
  cin>>n;
  long long A[n];
  long long R[n];
  for(long long i=0;i<n;i++){
    cin>>A[i];
  }
  for(long long i=0;i<n-1;i++){
    R[i]=abs(A[i]-A[i+1]);
  }
  R[n-1]=abs(k-A[n-1]+A[0]);
  
  /*for(long long i=0;i<n-1;i++){
    for(long long j=i+1;j<n;j++){
      if(R[i]>R[j]){
        swap(R[i],R[j]);
      }
    }
  }*/
  /*for(int i=0;i<n;i++){
    cout<<R[i]<<endl;
  }*/
  long long sum=0;
  /*for(long long i=0;i<n-1;i++){
    sum+=R[i];
  }*/
  long long max=0;
  for(long long i=1;i<n;i++){
    if(R[max]<R[i]){
      max=i;
    }
  }
  for(long long i=0;i<n;i++){
    if(i!=max){
    sum+=R[i];
    }
  }
  cout<<sum<<endl;
 return 0; 
}

Measured memory_bytes: 3328
N = int(input())
blue = []
for i in range(N):
    blue.append(input())

M = int(input())
red = []
for i in range(M):
    red.append(input())

count = {}
for s in blue:
    if s in count:
        count[s] += 1
    else:
        count[s] = 1
for t in red:
    if t in count:
        count[t] -= 1
    else:
        count[t] = -1

values = list(count.values())
keys = list(count.keys())
maxCount = max(values)
if maxCount > 0:
    print ( maxCount)
else:
    print (0)


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

int main(){
  long long x, s, t;
  t = 0;
  s = 10;
  cin >> x;
  if(x % 2ll == 1){
    cout << '0' << endl;
    return 0;
  }
  else{
    while(x / s > 0){
      t = t + x / s;
      s = s * 5ll;
    }
    cout << t << endl;
  }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

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

	min := a*(n-1) + b
	max := a + b*(n-1)

	if min > max {
		fmt.Println(0)
	} else {
		fmt.Println(max - min + 1)
	}
}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n;
    cin >> n;
    intl a[n];
    cin(i,a);
    intl all = 0;
    rep(i,n) all += a[i];
    intl min = 10e15;
    intl cnt = 0;
    rep(i,n){
        all -= a[i];
        cnt += a[i];
        if(n - 1 > i)min = min(min,abs(all - cnt));
    }
    cout << min << "\n";
    return 0;
}

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

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define sum(v) accumulate(all(v), 0)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define MOD 1000000007

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>

using namespace std;

main {
  int l,a,b,c,d;
  cin>>l>>a>>b>>c>>d;
  cout<<l-max((a+c-1)/c,(b+d-1)/d)<<endl;
  bye;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int w;
  cin >> s >> w;
  string ans = "";
  for (int i = 0; i < s.size(); i++) {
    if (i % w == 0) {
      ans += s[i];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		StringBuilder cout=new StringBuilder();
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		for (int i=1;i<=n;i++){
			int x=i;
			if (x%3==0){
				cout.append(" "+i);
				continue;}
			do{
				if (x%10==3){
					cout.append(" "+i);
					break;}
				x/=10;
			}while(x!=0);
		}
		System.out.println(cout);
	}
}

Measured memory_bytes: 22972
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>
#include<sstream>
#include<istream>
#include<numeric>
#include<stdlib.h>

using namespace std;

int main()
{

  int W, H, N;
  cin >> W >> H >> N;

  vector<int> x(N);
  vector<int> y(N);
  vector<int> a(N);

  for(int i=0; i<N; i++){
    cin >> x[i] >> y[i] >> a[i];
  }

  int x_min = 0;
  int x_max = W;
  int y_min = 0;
  int y_max = H;

  for(int i=0; i<N; i++){
    if(a[i] == 1){
      x_min = max(x_min,x[i]);
    }
    if(a[i] == 2){
      x_max = min(x_max,x[i]);
    }
    if(a[i] == 3){
      y_min = max(y_min,y[i]);
    }
    if(a[i] == 4){
      y_max = min(y_max,y[i]);
    }
  }

  if((y_max-y_min) < 0 || (x_max-x_min) < 0){
    cout << 0 << endl;
  }
  else{
    cout << (y_max-y_min)*(x_max-x_min) << endl;
  }

  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

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

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}




#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


  




string S;
//---------------------------------------------------------------------------------------------------
int solve() {
    int N = S.length();
    int ans = 0;
    for(int i=0; i < N;i+=2) if (i % 2 == 0) {
        string A = S.substr(0, i / 2);
        string B = S.substr(i / 2, i / 2);
        if (A == B) ans = max(ans, i);
    }
    return ans;
}
//---------------------------------------------------------------------------------------------------
int main() {
    cin >> S;
    cout << solve() << endl;
}

Measured memory_bytes: 3600
#include <set>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <vector>
#include <tuple>
#include <string>
#include <math.h>
#include <time.h>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <limits>
#include <climits>
#include <numeric>
#include <functional>

#define lnd '\n'
// #define reverse(i, n) for(ll i = n-1; i >= 0; --i)
#define from(i, n) for (ll i = 0; i < n; ++i)
#define loop(i, n) for(ll i = 0; i < n; i++)
#define REPN(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(s) (s).begin(), (s).end()
#define rALL(s) (s).rbegin(), (s).rend()
#define sz(s) (int)(s).size()
#define mk make_pair
#define pb push_back
#define sqr(s) ((s) * (s))

using namespace std;

typedef long long ll;
typedef long long int lli;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;

template <class T>
T GCD (T a, T b) {
  if(a == 0) return b;
  return GCD(b%a, a);
}

template <class T>
T LCM(T a, T b){
  return a*b/GCM(a,b);
}

template <class T>
T modpow(T x, T p){
    T res = 1;
    while(p > 0){
        if(p&1) res *= x;
        x *= x;
        p /= 2;
    }
    return res;
}

template <class T>
T modpow(T x, T p, ll mod){
    T res = 1;
    while(p > 0){
        if(p&1) res = (res*x)%mod;
        x = (x*x)%mod;
        p /= 2;
    }
    return res%mod;
}

template <class T>
void print(T a[], ll n){
    for (ll i = 0; i < n; i++) std::cout << a[i] << ' ';
    cout << endl;
}

template<class T>
void printc(T c){
    for(auto const& v: c) std::cout << v << ' ';
    cout << endl;
}

struct HASH{
  size_t operator()(const pair<long,long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

bool pair_sort(const pair<int, int> &p1, const pair<int,int> &p2){
    if(p1.first != p2.first) return p1.first < p2.first;
    else return p1.second < p2.second;
}

const int INF = std::numeric_limits<int>::max();
const ll M_INF = std::numeric_limits<ll>::min();
const ll LL_INF = std::numeric_limits<ll>::max();

void solution();
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solution();
    return 0;
}

void solution(){
  string s;
  cin >> s;
  if(s[0] == '7' || s[1] == '7' || s[2] == '7'){
    cout << "Yes"<< endl;
  }else{
    cout << "No"<< endl;
  }
}     



Measured memory_bytes: 3136
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(1, n-1):
  if p[i-1] < p[i] and p[i] < p[i+1]:
    ans += 1
  elif p[i-1] > p[i] and p[i] > p[i+1]:
    ans += 1
print(ans)

Measured memory_bytes: 3060
s=input()
t=input()

max=len(t)

for i in range(len(s)-len(t)+1):
    tmp_max=0
    for j in range(len(t)):
        if t[j]==s[i+j]:
            pass
        else:
            tmp_max+=1
    if max>tmp_max:
        max=tmp_max


print(max)

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

const ll INF = 1LL << 60;

int main() {
  ll N,K;
  cin >> N >> K;
  vector<ll> h(N);
  REP(i,N) {
    cin >> h[i];
  }
  sort( h.begin(), h.end() );
  ll ans = INF;
  REP(i,N-K+1) {
    ans = min( h[i+K-1] - h[i], ans );
  }
  cout << ans << endl;
}



Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<cmath>
#include<complex>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<ctime>
using namespace std;
int main(){
	long long N;
	scanf("%lld",&N);
	printf("50\n");
	for(int i=1;i<=50;i++)
		printf("%lld ",50-i+(50-i+N)/50);
}


Measured memory_bytes: 256
//
//diverta 2019
//C
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    int ans = 0;
    vector<int> type(4);
    //0:X..X
    //1:X..A
    //2:B..A
    //3:B..X
    REP(i, n) {
        string s;
        cin >> s;
        if (s[0]=='B'){
            if (s[s.size()-1] == 'A') type[2]++;
            else type[3]++;
        }else{
            if (s[s.size()-1] == 'A') type[1]++;
            else type[0]++;
        }

        REP(j, s.size()-1){
            if (s[j]=='A' && s[j+1]=='B') ans++; 
        }
    }
    if (type[2] > 0){
        ans += (type[2]-1);
        if (type[1]>0) {
            ans++;
            type[1]--;
        }
        if (type[3]>0) {
            ans++;
            type[3]--;
        }
    }
    ans += min(type[1], type[3]);

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


Measured memory_bytes: 3636