akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = LLONG_MAX;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
int main() {
    int a,b,c;cin >> a >> b >> c;
    if(a<c&&c<b||b<c&&c<a) puts("Yes");
    else puts("No");
    return 0;
}

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

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

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

  ll x; cin >> x;
  ll tmp = -1;
  int ans = 0;
  for(int i = 1; i*(i+1)/2 < x; i++) {
    tmp = i*(i+1)/2;
    ans = i;
  }

  cout << ans+1 << '\n';
  return 0;
}


Measured memory_bytes: 256
<?php

$nm = explode(' ', trim(fgets(STDIN)));

for($i=0; $i<$nm[1]; $i++){
  $l[$i] = $i+1;
}

for($i=0; $i<$nm[0]; $i++){
  $r = explode(' ', trim(fgets(STDIN)));
  unset($r[0]);
  $l = array_intersect($l, $r);
}

echo count($l);

?>

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

int main(){
  string s;cin>>s;s+='0';
  int i=0;
  long long ans=0;
  
  while(i<s.size()-1){
    //cout<<" i:"<<i<<endl;
    long long l=0,r=0;
    while(s.at(i)!='>'||s.at(i+1)!='<'){
      if(s.at(i)=='<') l++;
      else if(s.at(i)=='>') r++;        
      i++;
      //cout<<" l:"<<l<<" r:"<<r<<" i:"<<i<<endl;
      if(i==s.size()-1) break;
    }
    if(i!=s.size()-1) r+=1;
    if(l>=r) ans+=l*(l+1)/2+r*(r-1)/2;
    else ans+=r*(r+1)/2+l*(l-1)/2;
    //cout<<"ans:"<<ans<<endl;
    i++;
  } 
  cout<<ans;
}

Measured memory_bytes: 900
public class Main {


  private static void solve() {
    char[] s = ns();
    int min = Integer.MAX_VALUE;
    for (int i = 0; i < s.length - 2; i ++) {
      int x = Integer.parseInt(new String(s, i, 3));
      int d = Math.abs(x - 753);
      if (d < min) {
        min = d;
      }
    }
    System.out.println(min);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


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

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

    vector<int> a(M);
    vector<int> b(M);

    for(int i = 0; i < M; i++){
        cin >> a.at(i);
        cin >> b.at(i);
    }

    vector< vector<int> > allmap(N, vector<int>(N));

    for(int i = 0; i < M; i++){
        allmap.at(a.at(i) - 1).at(b.at(i) - 1) += 1;
        allmap.at(b.at(i) - 1).at(a.at(i) - 1) += 1;
    }

    for(int i = 0; i < N; i++){
        int ans = 0;
        for(int j =0; j < N; j++){
            ans += allmap.at(i).at(j);
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<double, double >pd;
typedef pair<string, string> sP;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const double eps = 1e-10;
const double PI = 3.14159265358979323846;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second


ll n, m, a, b;
vector<ll>v[100010], ans;
ll in[100010];
bool fl;

int main() {
	cin >> n >> m;
	for (int i = 0;i < m;i++) {
		cin >> a >> b;
		v[a].pb(b);
		in[b]++;
	}
	stack<ll>st;
	for (int i = 1;i <= n;i++) {
		if (!in[i])st.push(i);
	}
	while (!st.empty()) {
		if (st.size() > 1)fl = 1;
		ll p = st.top();
		ans.eb(p);
		st.pop();
		for (auto u : v[p]) {
			in[u]--;
			if (!in[u])st.push(u);
		}
	}
	for (auto u : ans) {
		cout << u << endl;
	}
	if (fl)cout << 1 << endl;
	else cout << 0 << endl;
	return 0;
}



Measured memory_bytes: 6680
import numpy as np


h,w,k = map(int,input().split())
connect = [[0 for i in range(w)] for j in range(w)]

if w == 1:
    print(1)
else:
    allstate = [""]
    befstate = [""]
    for i in range(w-1):
        for s in befstate:
            if s == "":
                allstate.append(s+str(i))
            else:
                last = int(s[-1])
                if (i-last)!=1:
                    allstate.append(s+str(i))
        befstate = allstate.copy()
        # print(befstate)
    # print(allstate)
    tot = len(allstate)
    for s in allstate:
        for c in s:
            temp = int(c)
            connect[temp][temp+1] += 1
            connect[temp+1][temp] += 1
    for i in range(w):
        temp = sum(connect[i])
        connect[i][i] = tot-temp
    buf = [0 for i in range(w)]
    buf[0] = 1
    for i in range(h):
        nbuf = [0 for i in range(w)]
        for j in range(w):
            for l in range(w):
                nbuf[l] += buf[j]*connect[j][l]
                nbuf[l]%=10**9+7
        buf = nbuf.copy()
    # print(buf)
    print(buf[k-1])



Measured memory_bytes: 13124
use std::fmt::Debug;
use std::str::FromStr;

pub struct TokenReader {
    reader: std::io::Stdin,
    tokens: Vec<String>,
    index: usize,
}

impl TokenReader {
    pub fn new() -> Self {
        Self {
            reader: std::io::stdin(),
            tokens: Vec::new(),
            index: 0,
        }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index += 1;
        self.tokens[self.index - 1].parse().unwrap()
    }

    pub fn vector<T>(&mut self) -> Vec<T>
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index = self.tokens.len();
        self.tokens.iter().map(|tok| tok.parse().unwrap()).collect()
    }

    pub fn load_next_line(&mut self) {
        let mut line = String::new();
        self.reader.read_line(&mut line).unwrap();

        self.tokens = line
            .split_whitespace()
            .map(String::from)
            .collect();
        self.index = 0;
    }
}

fn solve(num: i64) -> i64 {
    let mut m = 7;
    let mut s = 0;

    for i in 1..3 * num {
        s = (s + m % num) % num;
        if s == 0 {
            return i;
        }
        m = (m * 10) % num;
    }
    -1
}

fn main() {
    let mut reader = TokenReader::new();
    let num = reader.next();

    let res = solve(num);
    println!("{}", res);
}


Measured memory_bytes: 2172
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<long> nums;
	for(int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		nums.push_back(x);
	}

	long del_max = nums[1] - nums[0];
	long minv = nums[0];
	for (int j = 1; j < n; ++j) {
		long delta = nums[j] - minv;
		if (delta > del_max) {
			del_max = delta;
		}
		if (minv > nums[j]) {
			minv = nums[j];
		}
	}
	cout << del_max << endl;	
}

Measured memory_bytes: 3112
/**
 * @file main.cpp
 * @author Kentaro Sugimoto (tarotene@gmail.com)
 * @brief Input a pre-order traversal array and a in-order traversal array and output the post-order array by reconstructing the corresponding binary tree.
 * @version 0.1
 * @date 2019-03-24
 * 
 * @copyright Copyright (c) 2019
 * 
 */
#include <bits/stdc++.h>
using namespace std;

void reconstruct(int, int, vector<int> &, vector<int> &, map<int, int> &, vector<int> &);

int main(int argc, char const *argv[])
{
    int n = 0;
    cin >> n;

    vector<int> a_pre(n, 0), a_in(n, 0);
    map<int, int> b_pre, b_in;
    for (int i = 0; i < n; ++i)
    {
        cin >> a_pre[i];
        b_pre[a_pre[i]] = i;
    }
    for (int i = 0; i < n; ++i)
    {
        cin >> a_in[i];
        b_in[a_in[i]] = i;
    }

    vector<int> a_post;
    reconstruct(0, n, a_pre, a_in, b_in, a_post);

    for (int i = 0; i < n - 1; ++i) {
        cout << a_post[i] << " ";
    }
    cout << a_post[n - 1] << endl;

    return 0;
}

int pos = 0;

// [lb, rb)
void reconstruct(int lb, int rb, vector<int> &a_pre, vector<int> &a_in, map<int, int> &b_in, vector<int> &a_post)
{
    if (lb >= rb)
    {
        return;
    }
    else
    {
        int sub_root = a_pre[pos++];
        reconstruct(lb, b_in[sub_root], a_pre, a_in, b_in, a_post);
        reconstruct(b_in[sub_root] + 1, rb, a_pre, a_in, b_in, a_post);
        a_post.push_back(sub_root);
    }
}


Measured memory_bytes: 3156
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String w= scanner.next();
        long result=0;
        while(true){
            String t=scanner.next();
            if(t.equals("END_OF_TEXT")) break;
            t=t.toLowerCase();
            if(t.equals(w)) result++;

        }
        System.out.println(result);

    }

}



Measured memory_bytes: 26124
#include <stdio.h>
#define N 102
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define INF 1000000

int S[N][N],color[N],d[N],pi[N],sum=0,n;


void prim(int r){
  int i,u,min,v;
  for(i=0;i<n;i++){
  d[i]=INF;
  pi[i]=-1;
  color[i]=WHITE;
  }


  d[r]=0;

  while(1){
    min =INF;
    u=-1;
    for(i=0;i<n;i++){
      if (color[i] != 1 && d[i] < min){
      min = d[i];
      u = i;
    }
  }
    if (u==-1){
      break;
    }

color[u] = 1;

for (v=0;v<n;v++){
    if (color[v] != 1 && S[u][v] < d[v] && S[u][v] != -1){
      pi[v] = u;
      d[v] = S[u][v];
    }
  }
}
  for(i=0;i<n;i++){
    if(pi[i] != -1)sum+=S[i][pi[i]];
  }

}

int main(){

int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
    scanf("%d",&S[i][j]);
    }
  }
prim(0);
printf("%d\n",sum);
return 0;
}

Measured memory_bytes: 640
import java.util.*;
import java.util.Collections;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long A = 1;
    for (int i = 1; i <= N; i++) {
      A = A * i;
      A = (long) (A % (Math.pow(10, 9) + 7));
    }
    System.out.println(A);
  }
}


Measured memory_bytes: 23252
#include<set>
#include<map>
#include<stack>
#include<cmath>
#include<queue>
#include<deque>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
int read(){
	bool f=0;int x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c=='-')f=1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+c-'0',c=getchar();
	return !f?x:-x;
}
#define MAXN 500
#define INF 0x3f3f3f3f
char S[MAXN+5];
int main(){
	int a=read();
	scanf("%s",S);
	if(a>=3200) puts(S);
	else puts("red");
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        for (int i = 0 ; i < s.length() ; i++) {
            if (t.equals(s.substring(i, s.length()) + s.substring(0, i))) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }

}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
string f="snuke";
int main()
{
	int h,w;
	int x,y;
	string n[100][100];
	cin>>h>>w;
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			cin>>n[i][j];
			if(n[i][j]==f)
			{
				x=i;
				y=j;
			}
		}
	}
	char z='A'+y-1;
	cout<<z<<x<<endl;
 	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << "\n"; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


VV G;
V a, dp, ans;

void dfs(int u, int p=-1) {
  ans[u] = lower_bound(all(dp), INF-1) - dp.begin() - 1;
  for (auto &v : G[u]) if (v != p) {
    int i = lower_bound(all(dp), a[v]) - dp.begin();
    int tmp = dp[i];
    dp[i] = a[v];
    dfs(v, u);
    dp[i] = tmp;
  }
}


int main() {
  ll n; cin >> n;
  G.assign(n, V());
  a.assign(n, 0);
  dp.assign(n+1, INF);
  ans.assign(n, INF);
  dp[0] = -INF;
  cin >> a;

  rep(i, n-1) {
    int u, v; cin >> u >> v;
    --u, --v;
    G[u].push_back(v);
    G[v].push_back(u);
  }

  int v = 0;
  int i = lower_bound(all(dp), a[v]) - dp.begin();
  dp[i] = a[v];
  dfs(v);

  cout << ans;
  return 0;
}


Measured memory_bytes: 28016
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

K = INT()

a = 0
for i in range(K):
	a = (a+7*pow(10, i, K))%K
	if a == 0:
		print(i+1)
		break
		
else:
	print(-1)


Measured memory_bytes: 72804
//============================================================================
// Name        : alds1_1_d.cpp
// Author      : lovesaemi
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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

static const int MAX = 200000;

int main(void) {
	int R[MAX], n;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> R[i];
	}
	int maxv = -2000000000;
	int minv = R[0];
	for (int i = 1; i < n; i++) {
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
		//cout << maxv << ":" << minv << endl;
	}
	std::cout << maxv << std::endl;
	return 0;
	// -999999999
	// -999999999
}



Measured memory_bytes: 3844
n,*a=`dd`.split.map &:to_i
p (1..2*n).bsearch(&->x{
	b=a.map{|e|e<x}
	n.times{|i|[-1,1].map{|f|z=n-~i*f-1;return b[z]if b[z]==b[z-f]}};b[0]
})-1

Measured memory_bytes: 40376
// header {{{
#include <iostream>
#include <algorithm>
#include <vector>
#include <complex>
#include <utility>
#include <string>
#include <sstream>
#include <queue>
#include <map>
#include <list>
#include <stack>
#include <tuple>
#include <cstdio>
#include <cmath>
using namespace std;

#define ALPHABET    26
#define EPS         (1e-10)
#define EQ(a, b)    (abs((a)-(b)) < EPS)
#define INF         1000000005

typedef long long ll;
typedef unsigned long long ull;
// }}}

int main() {
    ll n, p;cin >> n >> p;
    vector<ll> a(n);
    for(auto &aa : a){
        cin >> aa;
        aa %= 2;
    }
    ll dp[n+1][2];
    dp[0][0] = 1;
    dp[0][1] = 0;
    for(int i=1;i<n+1;i++){
        if(a[i-1] == 0){
            dp[i][0] = dp[i-1][0]*2;
            dp[i][1] = dp[i-1][1]*2;
        }else{
            dp[i][0] = dp[i-1][0] + dp[i-1][1];
            dp[i][1] = dp[i-1][1] + dp[i-1][0];
        }
    }
    printf("%lld\n", dp[n][p]);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
#define mod 1000000007
int main() {
    int d, t, s;
    cin >> d >> t >> s;
    int dis = t * s;
    if (dis >= d) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <set>
#define N 200011
#define INF 1e99
#define int long long
using namespace std;
int Sum,fa[N],val[N],sum[N][2],ans,n,father[N];
int find(int u){
	if(u==father[u]) return u;
	return father[u]=find(father[u]);
}
struct point{
	int no;
	point(){}
	point(int x){
		no=x;
	}
	bool operator<(const point &other)const{
		if(sum[no][1]*sum[other.no][0]==sum[no][0]*sum[other.no][1]){
			if(sum[no][0]==sum[other.no][0] && sum[no][1]==sum[other.no][1]) return no>other.no;
			else if(sum[no][0]==sum[other.no][0]) return sum[no][1]<sum[other.no][1];
			else return sum[no][0]>sum[other.no][0];
		}
		return sum[no][1]*sum[other.no][0]<sum[no][0]*sum[other.no][1];
	}
}temp;
set<point> pq;
vector<int> V[N];
signed main(){
	scanf("%lld",&n);
	for(int i=2;i<=n;i++) scanf("%lld",&fa[i]),V[fa[i]].push_back(i);
	for(int i=1;i<=n;i++) scanf("%lld",&val[i]),sum[i][val[i]]=1,father[i]=i;
	for(int i=2;i<=n;i++) pq.insert(point(i));
	for(int i=1;i<n;i++){
		temp=*pq.begin();
		int x=temp.no;
		int f=find(fa[x]);
		if(f!=1) pq.erase(point(f));
		pq.erase(temp);
		ans+=sum[f][1]*sum[x][0];
		sum[f][0]+=sum[x][0],sum[f][1]+=sum[x][1];
		fa[x]=fa[f];father[x]=f;
		if(f!=1) pq.insert(point(f));
	}
	printf("%lld",ans);
	return 0;
}

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

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

using namespace std;

void solve(ll N, ll C, ll K, vector<ll> T){
    ll ans = 0;
	ll num = 0;
    sort(T.begin(), T.end());
	ll time = T[0];


    rep(i, N) {
		if (T[i] - time > K) {
			time = T[i];
			ans++;
			num = 1;
		} else if (num == C) {
			time = T[i];
			ans++;
			num = 1;
		} else {
            num++;
		}
    }
	ans++;
	cout << ans;
}

int main(){
    // 提出時は削除 //////////////////////////////
//	FILE* fp_in = freopen("/Users/kokinakamura/git/ToolsForAtCoder/workspace/agc011/A/in_A_2.txt", "r", stdin);
    ////////////////////////////////////////////

	ll N;
	ll C;
	ll K;
	scanf("%lld",&N);
	vector<ll> T(N-1+1);
	scanf("%lld",&C);
	scanf("%lld",&K);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&T[i]);
	}
	solve(N, C, K, T);

    // 提出時は削除 //////////////////////////////
//    fclose(fp_in);
    ////////////////////////////////////////////
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	ll a, b;
	cin >> a >> b;
	a %= 500;
	if (a <= b)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include<stdlib.h>
#define MAX_D 210
#define MAX_N 210

int D, N;
int T[MAX_D];
int A[MAX_N], B[MAX_N], C[MAX_N];
int suit[MAX_D][MAX_N];
int dp[MAX_D][MAX_N];

int main() {
	int i, j, k;

	scanf("%d%d", &D, &N);
	for (i = 0; i < D; ++i) {
		scanf("%d", &T[i]);
	}
	for (j = 0; j < N; ++j) {
		scanf("%d%d%d", &A[j], &B[j], &C[j]);
	}

	for (i = 0; i < D; ++i) for (j = 0; j < N; ++j) {
		suit[i][j] = (A[j] <= T[i] && T[i] <= B[j]);
	}

	for (i = 0; i < D; ++i) for (j = 0; j < N; ++j) {
		//	-1 : impossible
		dp[i][j] = -1;
	}
	for (j = 0; j < N; ++j) if (suit[0][j]) {
		dp[0][j] = 0;
	}
	for (i = 0; i < D - 1; ++i) for (j = 0; j < N; ++j) if (dp[i][j] >= 0) {
		for (k = 0; k < N; ++k) if (suit[i + 1][k]) {
			if (dp[i + 1][k] < dp[i][j] + abs(C[j] - C[k])) {
				dp[i + 1][k] = dp[i][j] + abs(C[j] - C[k]);
			}
		}
	}

	int ans = -1;
	for (j = 0; j < N; ++j) {
		if (ans < dp[D - 1][j]) {
			ans = dp[D - 1][j];
		}
	}
	printf("%d\n", ans);

	return 0;
}

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

#define MOD (1000000000+7)
#define MAX 100000

long long fac[MAX + 2];
long long ifac[MAX + 2];

long long mpow( long long x, long long n )
{
	long long ans = 1;
	while( n != 0 ) {
		if( n & 1 ) {
			ans = ans * x % MOD;
		}
		x = x * x % MOD;
		n = n >> 1;
	}
	return ans;
}

long long comb( long long a, long long b)
{
	if( a == 0 && b == 0 ) {
		return 1;
	}
    if( a < b || a < 0 ) {
		return 0;
	}
	long long tmp = ifac[a - b] * ifac[b] % MOD;
	return tmp * fac[a] % MOD;
}

int main()
{
	int n;
	vector<int> a, b;

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

	sort( b.begin(), b.end() );
	int d = 0;
	for( int i = 1; i <= n; i++ ) {
		if( upper_bound( b.begin(), b.end(), i )
			- lower_bound( b.begin(), b.end(), i ) > 1 ) {
			d = i;
			break;
		}
	}
	int l = -1, r = -1;
	for( int i = 0; i < n + 1; i++ ) {
		if( a[i] == d ) {
			if( l < 0 ) {
				l = i;
			}
			else {
				r = i;
			}
		}
	}
	
	fac[0] = 1;
	ifac[0] = 1;
	for( long long i = 0; i < MAX + 1; i++ ) {
		fac[i + 1] = fac[i] * (i + 1) % MOD;
		ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2 ) % MOD;
    }

	for( int i = 1; i <= n + 1; i++ ) {
		long long ans = ( comb( n + 1, i ) - comb( l + n - r, i - 1 ) + MOD ) % MOD;
		cout << ans << endl;
	}

	return 0;
}


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

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

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

    int max_r = 0;
    for(int i=0;i<n;i++){
        if(i==0) continue;
        max_r = max(a[i] - a[i-1],max_r); 
    }

    max_r = max(k-a[n-1]+a[0],max_r);

    cout << k - max_r << endl;

}

Measured memory_bytes: 4408
import sys
X, Y = map(int,input().split())
list1 = []
list2 = []

for x in range(0,101):
  for y in range(0,101):
    list1.append(x+y)
    list2.append(2*x+4*y)


for i in range(len(list1)):
  if list1[i] == X and list2[i] == Y:
    print('Yes')
    sys.exit()
print('No')

Measured memory_bytes: 9456
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedHashMap;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        while(true){
            String line = br.readLine();
            int n = Integer.parseInt(line);
            
            if(n == 0)break;
            
            LinkedHashMap<Integer, Long> employee = new LinkedHashMap<Integer, Long>();
            
            for(int i = 0;i < n;i++){
                String[] dataSet = br.readLine().split(" ");
                int e = Integer.parseInt(dataSet[0]);
                int p = Integer.parseInt(dataSet[1]);
                int q = Integer.parseInt(dataSet[2]);
                
                if(employee.containsKey(e)){
                    employee.put(e, employee.get(e) + (long)p * q);
                }else{
                    employee.put(e, (long)p * q);
                }
            }
            
            boolean zeroFlag = true;
            for(int e : employee.keySet()){
                if(employee.get(e) >= 1000000){
                    zeroFlag = false;
                    System.out.println(e);
                }
            }
            if(zeroFlag){
                System.out.println("NA");
            }
        }
    }
}



Measured memory_bytes: 26196
//#line 2 "SubstringQueries.cpp"

#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

int N;

int main() {
	cin >> N;
	if (N == 1) {
		cout << 1 << endl << 0 << endl;
		return 0;
	}
	if (N == 2) {
		cout << 2 << endl << 0 << endl << 11 << endl;
		return 0;
	}
	cout << N - 1 << endl;
	for (int i = 2; i <= N; ++i) {
		for (int j = 0; j < i; ++j) {
			if (j == 0 || j == i - 1) {
				cout << 0;
			}
			else {
				cout << 1;
			}
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repe(i, n) for (int i = 0; i <= (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int ll
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORe(i, m, n) for(int i = m;i <= n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
#define IN(a) cin >> a
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b,c; cin >> a >> b >> c;
    if(a+b >= c) Yes;
    else No;
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
char s[1100];
int main()
{
	scanf("%s",s);
	int m;
	scanf("%d",&m);
	int now=0;
	for(int i=0;i<strlen(s);i++)
	{
		if(now==0)
			printf("%c",s[i]);
		now=(now+1)%m;
	}
	return 0;
 } 

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
#define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

map<ll, ll> prime;
void factorize(int n) {
    for(int i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            prime[i]++;
            n /= i;
        }
    }
    if(n != 1) {
        prime[n] = 1;
    }
}


int main() {

    int n;
    cin>>n;
    int ans=n;
    factorize(n);
    irep(i,prime){
        ans/=i->first;
        ans*=i->first-1;
    }
    fin(ans);
}




Measured memory_bytes: 3124
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	s := next()
	ok := true
	if len(s)%2 == 1 {
		ok = false
	} else {
		for i := 0; i < len(s)/2; i += 2 {
			if s[i:i+2] != "hi" {
				ok = false
			}
		}
	}
	if ok {
		puts("Yes")
	} else {
		puts("No")
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define forn(i,n) for(ll i=0;i<n;i++)
#define fornn(i,a,b)  for(ll i=a;i<b;i++)
typedef  long long int ll;
using namespace std;


int main()
{
       string s,t;
       cin>>s>>t;
       ll n=s.size();
       ll m=t.size();

        ll dp[n+1][m+1];

        for(ll i=0;i<=n;i++)
        {
            for(ll j=0;j<=m;j++)
            {
                     if(i==0 || j==0)
                     	dp[i][j]=0;

                     else
                     {

                           if(s[i-1]==t[j-1])
                           	{ dp[i][j]=dp[i-1][j-1]+1;}

                           else
                           	dp[i][j]=max(dp[i][j-1],dp[i-1][j]);

                     }
            }

        }
	    
          ll c=1;

     
         string k;
	     int i=n,j=m;
          while(dp[i][j]!=0)
	      {
              if(dp[i-1][j]==dp[i][j])
            	   i--;

            	 else if(dp[i][j-1]==dp[i][j])
            	 j--;


                 else
                  {
                 	k= s[i-1]+k;
                 	i--;
                 	j--;
                 }
            
        }    
         cout<<k;
	   //SS cout<<dp[n][m];

	return 0;
}

Measured memory_bytes: 70656
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

class BinaryIndexedTree
{
private:
    int n;
    vector<int> data;
public:
    BinaryIndexedTree(int n){ // コンストラクタ
        this->n = n;
        data.assign(n+1, 0);
    }
    void add(int k, int x){ // k番目の要素にxを加算する
        ++ k;
        while(k <= n){
            data[k] += x;
            k += k & -k;
        }
    }
    int sum(int k){ // 区間[0,k]の総和を返す
        ++ k;
        int ret = 0;
        while(k > 0){
            ret += data[k];
            k -= k & -k;
        }
        return ret;
    }
    int sum(int a, int b){ // 区間[a,b]の総和を返す
        return sum(b) - sum(a-1);
    }
};

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0; i<n; ++i){
        cin >> a[i];
        a[i] -= k;
    }

    long long sum = 0;
    map<long long, int> index;
    index[0];
    for(int i=0; i<n; ++i){
        sum += a[i];
        index[sum];
    }
    int m = 0;
    for(auto& p : index){
        p.second = m;
        ++ m;
    }

    long long ans = 0;
    BinaryIndexedTree bit(m);
    sum = 0;
    for(int i=0; i<n; ++i){
        bit.add(index[sum], 1);
        sum += a[i];
        ans += bit.sum(0, index[sum]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 14336
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;

void func(vector<vector<int>>&edge, vector<int>&dp, int &ans, int node = 0, int p = -1) {
	vector<int>box;
	for (auto i : edge[node]) {
		if (i == p)continue;
		func(edge, dp, ans, i, node);
		box.push_back(dp[i]);
	}
	sort(box.rbegin(), box.rend());
	if (node == 0) {
		if (box.size() >= 2) {
			dp[node] = box[0] + box[1] + 1;
			ans = max(dp[node], ans);
		}
	}
	else if (box.empty()) {
		dp[node] = 0;
	}
	else if (box.size() == 1) {
		dp[node] = box[0] + 1;
		ans = max(ans, dp[node]);
	}
	else if (box.size() >= 2) {
		dp[node] = box[0];
		ans = max(box[0] + box[1], ans);
	}
	return;
}

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

	cin >> N;
	vector<vector<int>>edge(N);
	for (int i = 1; i < N; i++) {
		cin >> L >> R;
		L--, R--;
		edge[L].push_back(R);
		edge[R].push_back(L);
	}
	int ans = 0;
	vector<int>dp(N);
	func(edge, dp, ans);
	for (int i = 0; i < N; i++) {
		ans += edge[i].size() == 1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 9252
#include<stdio.h>
#include<cstring>
const int maxn = 10005;
const int mod = 998244353;
int add(int x,int y) { x+=y; return x>=mod?x-mod:x; }
int sub(int x,int y) { x-=y; return x<0?x+mod:x; }
int mul(int x,int y) { return 1ll*x*y%mod; }
int sqr(int x) { return 1ll*x*x%mod; }
int fac[maxn],inv[maxn];
char s1[maxn],s2[maxn];
int n;
int f[maxn][maxn];
int GC(int x,int y) {  if(x<y) return 0;return mul(fac[x],mul(inv[y],inv[x-y])); }
int main() {
	fac[0] = 1; inv[0] = inv[1] = 1;
	for(int i=1;i<=10000;i++) fac[i] = mul(fac[i-1],i);
	for(int i=2;i<=10000;i++) inv[i] = mul(inv[mod%i],mod-mod/i);
	for(int i=1;i<=10000;i++) inv[i] = mul(inv[i-1],inv[i]);
	scanf("%s%s",&s1[1],&s2[1]); n = std::strlen(s1+1);
	int A=0,B=0;
	for(int i=1;i<=n;i++) if((s1[i]-'0')|(s2[i]-'0'))(s1[i]==s2[i] ?A++:B++);
	B/=2;
	if((!A)||(!B)) { printf("%d",sqr(fac[A+B])); return 0; }
	for(int i=0;i<=B;i++) f[0][i] = sqr(fac[i]);
	for(int i=1;i<=A;i++) {
		for(int j=1;j<=B;j++) {
			f[i][j] = add( mul(f[i][j-1],sqr(j)) , mul(f[i-1][j],mul(i,j)) );
		}
	}
	int ans = 0;
	for(int i=0;i<=A;i++) {
		ans = add(ans,mul(f[A-i][B],mul(GC(A,i),mul(GC(A+B,i),sqr(fac[i])))));
	}
	printf("%d",ans);
}

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

using ll=long long; 

void solve(){
	int n;
	string s;
	cin>>n>>s;
	if(n%2==1){
		cout<<"No"<<endl;
		return;
	}	
	if(s.substr(0,n/2)==s.substr(n/2,n/2)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
}

signed main(){
	//while(1)
	solve();
}

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

using namespace std;
#define ll long long int

int main()
{
   ll t;
   t = 1;	
   //cin >> t;
   while(t--){
         ll n;
         cin >> n;
         ll a[n];
         for(int i =0 ; i < n ; i++)
         {
             cin >> a[i];
         }    
         sort(a , a + n);
         ll ans = 0;
         ll i = n - 2;
         ll j = n - 1;
         ll count = 1;
         while( i >=0)
         {
             while(count!=0 && i>=0)
             {
                 ans += a[j];
                 count--;
                 i--;
             }
             count = 2;
             j--;

         }
         cout << ans << endl;
   }
}


Measured memory_bytes: 5136
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
int main() {
  string s;
  int ans=753,a;
  cin>>s;
  rep(i,s.size()-2){
    a=100*(int)s[i]+10*(int)s[i+1]+(int)s[i+2]-5328;
    ans=min(abs(753-a),ans);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import Counter
INF = float("inf")


def solve(N: int, s: "List[str]", M: int, t: "List[str]"):
    m = 0
    rec = ""
    sc = Counter(s)
    st = Counter(t)
    for c, v in sc.items():
        if m < v - st[c]:
            rec = c
            m = v - st[c]
    print(m)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    M = int(next(tokens))  # type: int
    t = [next(tokens) for _ in range(M)]  # type: "List[str]"
    solve(N, s, M, t)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3436
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int n,m,cap;
  while(cin>>n>>m>>cap,n||m||cap){
    map<string,int> ms;
    string src,dst;
    cin>>src>>dst;
    ms[src]=0;ms[dst]=1;
    vector<P> G[10000];
    for(int i=0;i<n;i++){
      string a,b;
      int c;
      cin>>a>>b>>c;
      if(!ms.count(a)) ms[a]=ms.size()-1;
      if(!ms.count(b)) ms[b]=ms.size()-1;
      G[ms[a]].push_back(P(ms[b],c));
      G[ms[b]].push_back(P(ms[a],c));
    }
    
    int v=ms.size(),inf=1<<25;
    int dp[m+2][v];
    vector<string> vs(m+2);
    for(int i=0;i<m+2;i++){
      for(int j=0;j<v;j++) dp[i][j]=inf;
      if(i<m) cin>>vs[i];
      else if(i==m) vs[i]=src;
      else vs[i]=dst;
      int u=ms[vs[i]];
      priority_queue<P> q;
      dp[i][u]=0;
      q.push(P(0,u));
      while(!q.empty()){
	P p=q.top();q.pop();
	int x=p.second;
	if(dp[i][x]<-p.first) continue;
	for(P y:G[x]){
	  if(dp[i][x]+y.second<dp[i][y.first]){
	    dp[i][y.first]=dp[i][x]+y.second;
	    q.push(P(-dp[i][y.first],y.first));
	  }
	}
      }
    }

    int e[m+2][m+2];
    for(int i=0;i<m+2;i++)
      for(int j=0;j<m+2;j++)
	if(dp[i][ms[vs[j]]]<=cap*10)
	  e[i][j]=dp[i][ms[vs[j]]];
	else e[i][j]=inf*(i!=j);
    
    for(int k=0;k<m+2;k++)
      for(int i=0;i<m+2;i++)
	for(int j=0;j<m+2;j++)
	  e[i][j]=min(e[i][j],e[i][k]+e[k][j]);

    cout<<(e[m][m+1]<inf?e[m][m+1]:-1)<<endl;
    
  }
  return 0;
}

Measured memory_bytes: 8128
#include<stdio.h>

int main(){
  char card[36][3];
  int N,i,j,minj,Order[36],tmp,check=0,stable=0;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    Order[i]=i;
    scanf("%s",card[i]);
    
  }
  
  while(1){
    for(i=N-1;i>0;i--){
      if(card[Order[i-1]][1] > card[Order[i]][1]){
	tmp = Order[i];
	Order[i] = Order[i-1];
	Order[i-1] = tmp;
	check++;
      }
    }
    if(check == 0)break;
    check = 0;  
  }
  for(i=0;i<N;i++){
    if(i==N-1)printf("%s\n",card[Order[i]]);
    else printf("%s ",card[Order[i]]);
    if(i < N-1 && card[Order[i]][1] == card[Order[i+1]][1] && Order[i] > Order[i+1])stable=-1;
  }
  if(stable == -1)printf("Not stable\n");
  else printf("Stable\n");

  for(i=0;i<N;i++)Order[i]=i;
  for(i=0;i<N-1;i++){
    for(minj = j = i+1;j<N;j++){
      if (card[Order[minj]][1] > card[Order[j]][1] ) minj = j;
    }
    if(card[Order[i]][1] >card[Order[minj]][1] ){
      tmp = Order[i];
      Order[i] = Order[minj];
      Order[minj] = tmp;
    } 
  }
  for(i=0;i<N;i++){
    if(i==N-1)printf("%s\n",card[Order[i]]);
    else printf("%s ",card[Order[i]]);
    if(i < N-1 && card[Order[i]][1] == card[Order[i+1]][1] && Order[i] > Order[i+1])stable=-1;
  }
  if(stable == -1)printf("Not stable\n");
  else printf("Stable\n");
  
  return 0;
}


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

#define ll long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){ return (a % b)? gcd(b, a%b) : b; }
template<typename T> T lcm(T a, T b){ return a * b / gcd(a, b); }

const int mod = MOD;
struct mint{
    ll x;
    //コンストラクタ
    mint(ll x=0):x((x%mod+mod)%mod){}

    // %は若干遅いから，%を使わないようにしている
    mint& operator+=(const mint a){
        if((x += a.x) >= mod) x-= mod;
        return *this;
    }

    mint& operator-=(const mint a){
        if((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a){
        (x *= a.x) %= mod;
        return *this;
    }
    
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint power(ll t) const { // x^t
        if(!t) return 1;
        mint ans = power(t >> 1);
        ans *= ans;
        if(t&1) ans *= *this;
        return ans;
    }

    //素数が絡むやつ
    mint inv() const{
        return power(mod-2);
    }
    mint& operator/=(const mint a){
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const{
        mint res(*this);
        return res /= a;
    }
};

istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination{
    vector<mint> factorial, ifactorial;
    combination(int n) :factorial(n+1), ifactorial(n+1){
        factorial[0] = 1;
        //分子　そのまま計算
        for(int i = 1; i <= n; i++) factorial[i] = factorial[i-1] * i;

        //分母　処理が重いので一発で済ませたい
        ifactorial[n] = factorial[n].inv();
        for(int i = n; i >= 1; i--) ifactorial[i-1] = ifactorial[i] * i;
    }
    mint operator()(int n , int k){
        if(k < 0 || n < k) return 0;
        return factorial[n] * ifactorial[k] * ifactorial[n-k];
    }
};

int main(void){
    int s;
    cin >> s;
    int k = 1;

    mint ans(0);
    combination c(s);
    
    while(s-3*k>=0){
        int n = s-3*k;
        ans += c(n+k-1, k-1);
        k++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620