akhauriyash/Code-Regression huggingface dataset:
n = int(input())
a = list(map(int, input().split()))

ruiseki_add = [0] * (n + 1)
for i in range(n):
    ruiseki_add[i + 1] = ruiseki_add[i] + a[i]

ruiseki_xor = [0] * (n + 1)
for i in range(n):
    ruiseki_xor[i + 1] = ruiseki_xor[i] ^ a[i]
    
def solve(s, mid):
    xor_sum = ruiseki_add[mid + 1] - ruiseki_add[s] 
    add_sum = ruiseki_xor[mid + 1] ^ ruiseki_xor[s]
    if xor_sum == add_sum:
        return True
    else:
        return False

ans = 0
for i in range(n):
    ok = i
    ng = n
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if solve(i, mid):
            ok = mid
        else:
            ng = mid
    ans += ng - i
print(ans)

Measured memory_bytes: 76876
import sys
input = sys.stdin.readline

S = input().replace('\n', '')
T = input().replace('\n', '')

alphabet = 'abcdefghijklmnopqrstuvwxyz'
len_alphabet = len(alphabet)
dict_alphabet = {chara: i for i, chara in enumerate(alphabet)}


def calc_state(target_string):
    state_idx = [[] for _ in range(len_alphabet)]
    state_count = [0 for _ in range(len_alphabet)]

    for i, chara in enumerate(target_string):
        alphabet_idx = dict_alphabet[chara]
        state_idx[alphabet_idx].append(i)
        state_count[alphabet_idx] += 1

    return state_idx, state_count


state_idx_s, state_count_s = calc_state(S)
state_idx_t, state_count_t = calc_state(T)


if sorted(state_count_s) != sorted(state_count_t):
    print('No')
    exit()

# If the same alphabet appears twice in succession in S,
# does the same law occurs in T?
last_s = None
last_t = None
for s, t in zip(S, T):
    if last_s == s and last_t != t:
        print('No')
        exit()
    last_s, last_t = s, t

print('Yes')

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

constexpr int INF = 1e9;
constexpr ll INFLL = 1e18;
constexpr int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    //cout << fixed << setprecision(6);
    int d,t,s;
    cin >> d >> t >> s;

    cout << (d <= t*s ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3656
using System;
using System.Collections;
using System.IO;
using System.Linq;

namespace CompetitiveProgramming
{
  
  class Solve
  {
    const int INF = (int)(1e9) + 10;

    private void Main()
    {
      string SA = Console.ReadLine();
      string SB = Console.ReadLine();
      string SC = Console.ReadLine();

      int turn = 0;
      while (true)
      {
        if (turn == 0)
        {
          if (SA == "") 
          {
            Console.WriteLine("A");
            return;
          }
          char c = SA[0];
          SA = SA.Substring(1);
          if (c == 'b')
          {
            turn = 1;
          }
          else if (c == 'c')
          {
            turn = 2;
          }
        }
        else if (turn == 1)
        {
          if (SB == "")
          {
            Console.WriteLine("B");
            return;
          }
          char c = SB[0];
          SB = SB.Substring(1);
          if (c == 'a')
          {
            turn = 0;
          }
          else if (c == 'c')
          {
            turn = 2;
          }
        }
        else if (turn == 2)
        {
          if (SC == "")
          {
            Console.WriteLine("C");
            return;
          }
          char c = SC[0];
          SC = SC.Substring(1);
          if (c == 'a')
          {
            turn = 0;
          }
          else if (c == 'b')
          {
            turn = 1;
          }
        }
      }
    }

    public Solve()
    {
      Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
      Main();
      Console.Out.Flush();
    }
  }

  class Program
  {
    static void Main(string[] args)
    {
      new Solve();
    }
  }
}

Measured memory_bytes: 2776
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
#define rep(b,e) for(int i=b;i<e;i++)
int main(){
  string a,b;
  cin>>a>>b;
  int num=stoi(a+b);
  rep(1,1001){
    if(i*i==num){
      cout<<"Yes"<<"\n";
      return 0;
    }
  }
  cout<<"No"<<"\n";
}


Measured memory_bytes: 256
using System;

class C
{
	static void Main()
	{
		var h = Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
		double n = h[0], k = h[1];
		Console.WriteLine(n < k ? Push(n, k) : (n - k + 1) / n + (k - 1) / n * Push(k - 1, k));
	}

	static double Push(double n, double k)
	{
		double s = 0.0, p = 1.0, m = k, x = n;
		while (x > 0)
		{
			p /= 2;
			m /= 2;
			var c = Math.Max(Math.Floor(x - m + 1), 0);
			x -= c;
			s += c / n * p;
		}
		return s;
	}
}


Measured memory_bytes: 11220
def examD():
    N, C = LI()
    S = [0] * N; T = [0] * N; c = [0] * N
    # s = t = c =0
    maxt = int(0)
    for i in range(N):
        s, t, a = LI()
        S[i], T[i] = s, t
        c[i] = a
        if maxt < t:
            maxt = t
    pairs = zip(S, T,c)
    sortedpairs = sorted(pairs, key=lambda x: x[1])
    sortedpairs = sorted(sortedpairs, key=lambda x: x[0])
    for i in range(N):
        S[i] = sortedpairs[i][0]
        T[i] = sortedpairs[i][1]
        c[i] = sortedpairs[i][2]
#    print(S)
#    print(T)
#    print(c)
    ans = int(0)
    time = [0] * (maxt + 2)
    timeC = [[] for _ in range(maxt + 2)]
    for i in range(N):
        ##########同じチャンネル
        timeC[T[i]].append(c[i])
        if not c[i] in timeC[S[i]]:
            time[S[i]] += 1
            time[T[i] + 1] -= 1
        else:
            time[S[i] + 1] += 1
            time[T[i] + 1] -= 1

    ansC = int(0)
    for i in range(maxt + 1):
        ansC += time[i]
        ans = max(ansC, ans)
    # print(time)
    print(ans)
    # print(timeC)

import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()


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

int main(){
    vector<ll> n(3);
    REP(i, 3) cin >> n[i];
    ASC(n);
    cout << n[0]+n[1] << "\n";
}


Measured memory_bytes: 3616
import java.util.*;

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

        while(N >= 500){
            N -= 500;
        }
        if(N <= A){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23252
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

A = np.array(A, dtype=int)
a = A.argsort() + 1

print(*a)


Measured memory_bytes: 24392
#include <cstdio>

using namespace std;

int a[200000];
int f[200000];

int main() {
    int n, x, i, j;
    
    scanf("%d %d", &n, &x);
    
    if (x == 1 || x == n * 2 - 1) {
        puts("No");
    } else {
        puts("Yes");

        f[x] = 1;
        a[n - 1] = x;
        f[x - 1] = 1;
        a[n - 2] = x - 1;
        f[x + 1] = 1;
        a[n] = x + 1;
        
        if (x - 2 > 0) {
            f[x - 2] = 1;
            a[n + 1] = x - 2;
        } else if (x + 2 > 0) {
            f[x + 2] = 1;
            a[n - 3] = x + 2;
        }
        
        for (i = 0, j = 1; i < n * 2 - 1; i++) {
            if (a[i] == 0) {
                for (; ; j++) {
                    if (f[j] == 0) {
                        printf("%d\n", j++);
                        
                        break;
                    }
                }
            } else {
                printf("%d\n", a[i]);
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define show(x) cout<<x<<'\n'
#define showh(x) cout<<x<<' '
#define go(i,a,n) for(ll i=a;i<n;i++)
#define gor(i,a,n) for(ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
bool prime[100001];
bool ispoweroftwo(ll x)
{
    return x && !(x & (x-1));
}
ll xorcal(ll n)
{
    if(n%4==0)
        return n;
    if(n%4==1)
        return 1;
    if(n%4==2)
        return n+1;
    if(n%4==3)
        return 0;
}
void sieve(ll n)
{
    memset(prime,true,sizeof(prime));
    prime[0]=false;
    prime[1]=false;
    for(ll i=2;i*i<=n;i++)
    {
        if(prime[i]==true)
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                prime[j]=false;
            }
        }
    }
    show(prime[89]);
}
bool isprime(ll n)
{
    if (n<=1) return false;
    if (n<=3) return true;

    if(n%2==0 or n%3==0) return false;

    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0 or n%(i+2)==0) return false;
    }
    return true;
}

ll modinverse(ll a,ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m; a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
       x += m0;

    return x;
}

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

ll power(ll A, ll B)
{
    if (A == 0)
        return 0;
    if (B == 0)
        return 1;

    ll y;
    if (B % 2 == 0) {
        y = power(A, B / 2);
        y = (y * y) % mod;
    }

    else {
        y = A % mod;
        y = (y * power(A, B - 1) % mod) % mod;
    }

    return (ll)((y + mod) % mod);
}

int main()
{
    ios_base::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;
    ll i=0,count=0,maxi;
    while(i<2)
    {
        if(a>b)
        {
            count+=a;
            a--;
        }
        else
        {
            count+=b;
            b--;
        }
        i++;
    }
    show(count);
    return 0;

}


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

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  long long sum = 0;
  for(int i=0; i<N; i++){
    cin >> A[i];
    sum+=A[i];
  }
  int count=0;
  for(int i=0; i<N; i++){
    if((double)A[i] < (double)sum/(4*M))continue;
    else count+=1;
  }
  if(count >= M){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
/*author @sushil*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sushil ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test() long long t;cin>>t;while(t--)
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s[0]=='7'||s[1]=='7'||s[2]=='7')
  cout<<"Yes";
  else
  cout<<"No";
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(void)
{
	
	int n, m;
	while (1)
	{
		cin>>n;
		if(n==0)break;
		int map[21][21]={};

		for (int i = 0; i < n; ++i)
		{
			int x, y;
			cin >> x >> y;
			map[y][x] = 1;
		}
		cin >> m;
		int dx[] = {0, 0, -1, 1};
		int dy[] = {-1, 1, 0, 0};
		int mx, my, count;
		mx = my = 10;
		count = 0;
		for (int i = 0; i < m; ++i)
		{
			char d;
			int l;
			cin >> d >> l;
			switch (d)
			{
			case 'N':
				d = 1;
				break;
			case 'S':
				d = 0;
				break;
			case 'E':
				d = 3;
				break;
			case 'W':
				d = 2;
				break;
			}
			for (int j = 0; j < l; ++j)
			{
				mx += dx[d];
				my += dy[d];
				if (map[my][mx])
				{
					map[my][mx] = 0;
					count++;
				}
			}
		}
		if (count == n)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3108
from collections import Counter


class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        x = self.find(x)
        return self.size[x]


n, m = map(int, input().split())

uf = UnionFind(n)
for i in range(m):
    x, y, z = map(int, input().split())
    uf.union(x-1, y-1)

c = Counter([uf.find(i) for i in range(n)])
print(len(c))

Measured memory_bytes: 22120
from collections import Counter
N=int(input())
A=sorted(map(int,input().split()))
li=[]
i=0
while(i<N):
    cnt=0
    j=i
    while(j<N and A[i]==A[j]):
        cnt+=1
        j+=1
    li.append(cnt-1)
    i=j
l=len(li)
for i in range(l):
    for j in range(i+1,l):
        if li[i]==0:
            break
        d=min(li[i],li[j])
        li[i]-=d
        li[j]-=d
for i in range(l):
    li[i]%=2
ans=len(set(A))
for i in range(l):
    ans-=li[i]
print(ans)

Measured memory_bytes: 105112
#include <stdio.h>
int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
        }
    else if(a>b)
    {printf("a > b\n");}
    else if(a==b)
    {printf("a == b\n");}








    return 0;
}

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

using namespace std;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}


int main(void){
	int N;
	cin >> N;
	vector<pair<int,int>> ab(N);
	for(int i=0;i<N;i++){
		cin >> ab[i].first >> ab[i].second;
	}
	sort(ab.begin(),ab.end(),compare_by_b);
	long long now = 0;
	for(int i=0;i<N;i++){
		if(now+ab[i].first<=ab[i].second){
			now += ab[i].first;
		}else{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 1920
#include"bits/stdc++.h"
using namespace std;
#define LL long long

LL N, L;
LL p[100000], d[100000];
int main(){
	cin >> N >> L;
	vector<pair<int, int>> v(N);
	for(int i=0; i<N; i++) cin >> v[i].first >> v[i].second;
	sort(v.begin(), v.end());
	for(int i=0; i<N; i++){
		p[i] = v[i].first;
		d[i] = v[i].second;
	}

	LL ans = 0;
	LL tmp = 0;
	for(int i=0; i<N; i++){
		tmp += (p[i]-(i+1)) * (d[i] == 0 ? 1 : -1);
	}
	ans = tmp;
	for(int i=0; i<N; i++){
		tmp += ((L-i)-(N-i)) * (d[N-i-1] == 1 ? 1 : -1);
		ans = max(ans, tmp);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5208
// https://atcoder.jp/contests/abc106/tasks/abc106_b
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int_fast32_t i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int_fast32_t i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

vector<int> a = {105, 135, 165, 189, 195};

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    if (N >= 195) {
        cout << "5\n";
    } else if (N >= 189) {
        cout << "4\n";
    } else if (N >= 165) {
        cout << "3\n";
    } else if (N >= 135) {
        cout << "2\n";
    } else if (N >= 105) {
        cout << "1\n";
    } else {
        cout << "0\n";
    }
    return 0;
}


Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};

//
template <typename T>
class ModUtil {
public:
  ModUtil(int N, T mod)
      : N(N), mod(mod), fact(N + 1) {
    calc();
  }

  T get_inv(int x) {return modpow(x, mod - 2);}
  T get_fact(int n) { return fact[n]; }
  T get_inv_fact(int n) { return get_inv(fact[n]); }
  T get_P(int n, int k) {
    if (n < k)
      return 0;
    return fact[n] % mod * get_inv_fact(n - k) % mod;
  }
  T get_C(int n, int k) {
    if (n < k)
      return 0;
    return fact[n] * get_inv_fact(k) % mod * get_inv_fact(n - k) % mod;
  }
  T modpow(int a, int n){
    if (n == 0)return 1;
    T res = modpow(a, n / 2);
    res *= res;
    res %= mod;
    if (n % 2)res *= a;
    return res % mod;
  }
private:
  vector<T> fact;
  int N;
  T mod;
  // O(N)
  void calc() {
    fact[0] = 1;
    for (int i = 1; i <= N; i++) {
      fact[i] = i * fact[i - 1] % mod;
    }
  }
};
const int MAX_HW = 216000;
ModUtil<ll> mod_util(MAX_HW, MOD);
ll pat(int p, int q){return mod_util.get_C(p + q - 2, q - 1);}
int H,W,A,B;
int main() {
  cin >> H >> W >> A >> B;
  ll sum = 0;

  for (int i = 0; i < H - A; i++){
    ll res = mod_util.get_C(i + B - 1, B - 1) % MOD * mod_util.get_C(H + W - 2 - B - i, W - 1 - B) % MOD;
    // res = pat(i + 1 , B) * pat(H - i, W - B);
    sum += res;
    sum %= MOD;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1920
module Main where

import Control.Applicative
import Numeric
import Data.List

type House = [Floor]
type Floor = [Room]
type Room = Int

officialHouseIntit :: [House]
officialHouseIntit = replicate 4 houseInit

houseInit :: House
houseInit = replicate 3 floorInit

floorInit :: Floor
floorInit = replicate 10 roomInit

roomInit :: Room
roomInit = 0

showOfficialHouse :: [House] -> String
showOfficialHouse = intercalate (replicate 20 '#' ++ "\n") . map showHouse

showHouse :: House -> String
showHouse = unlines . map showFloor

showFloor :: Floor -> String
showFloor = concatMap ((' ' :) . showRoom)

showRoom :: Room -> String
showRoom = show


main :: IO()
main = do
  { [n] <- getInts
  ; hs <- loop n officialHouseIntit
  ; putStr $  showOfficialHouse hs
  }

loop :: Int -> [House] -> IO [House]
loop 0 hs = return hs
loop n hs = do
  { [b,f,r,v] <- getInts
  ; let (fronts, ho : ends) = splitAt(b - 1) hs
  ; let (lows, fl: ups )    = splitAt(f - 1) ho
  ; let (xs, rm : ys)       = splitAt(r - 1) fl
  ; let fl' = xs ++ (rm + v) : ys
  ; let ho' = lows ++ fl' : ups
  ; let hs' = fronts ++ ho' : ends
  ; loop (n -1) hs'
  }

--

getInts :: IO[Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO()
putInts = putStrLn . unwords . map show

getDoubles :: IO[Double]
getDoubles = map read . words  <$> getLine

putDoubles :: [Double] -> IO()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""


Measured memory_bytes: 4628
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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 dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[4]={0,1,0,-1},mdy[4]={-1,0,1,0};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

bool t[20000];
int n,d;
int x[15][15];

int main(){
	cin>>n>>d;
	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++){
			cin>>x[i][j];
		}
	}
	int ans=0;
	for(int i=0;i<20000;i++)t[i]=0;
	for(int i=0;i<=130;i++)t[i*i]=1;
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			int t1=0;
			for(int k=0;k<d;k++){
				t1+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
			}
			if(t[t1])ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 

////////////////////////////////////////////////////////


int main() {
    ll n, k; cin >> n >> k;
    string s; cin >> s;
    ll cnt = 0;
    ll rl = 0;
    rep(i, 0, sz(s)-1){
        if(s[i] == 'R' && s[i+1] == 'R') cnt++;
        if(s[i] == 'L' && s[i+1] == 'L') cnt++;
        if(s[i] == 'R' && s[i+1] == 'L') rl++;
    }
    cnt += 2*k;
    if(cnt > n-1) cnt = n-1;
    co(cnt);

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>

int main()
{
    const int MAX = 1 << 29;
    int N;
    std::cin >> N;

    std::vector<int> steps(N);
    for (int i=0; i<N; ++i)
    {
        std::cin >> steps[i];
    }

    std::vector<int> dp(N+1, MAX);
    dp[0] = 0;

    for (int i=0; i<N; ++i)
    {
        // i番目の足場へうつる -> 1つ前から飛んだ時 or 2つ飛ばしで来たときのスコア
        dp[i+1] = std::min(dp[i] + std::abs(steps[i+1] - steps[i]), dp[i+1]);

        if (i + 2 < N)
        {
            // i+2番目の足場へ移る
            dp[i+2] = dp[i] + std::abs(steps[i+2] - steps[i]);
        }
    }

    std::cout << dp[N-1] << std::endl;
}

Measured memory_bytes: 1024
N = int(input())

dic = {}
for i in range(N):
    s = input()
    
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1

if 'AC' not in dic:
    dic['AC'] = 0
if 'WA' not in dic:
    dic['WA'] = 0
if 'TLE' not in dic:
    dic['TLE'] = 0
if 'RE' not in dic:
    dic['RE'] = 0
    
AC = dic['AC']
print(f'AC x {AC}')

WA = dic['WA']
print(f'WA x {WA}')

TLE = dic['TLE']
print(f'TLE x {TLE}')

RE = dic['RE']
print(f'RE x {RE}')

Measured memory_bytes: 9172
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;

signed main(){
    char c;cin>>c;
    cout<<(c=='a'||c=='e'||c=='o'||c=='i'||c=='u'?"vowel":"consonant")<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 200

void push(int);
int pop(void);

int top = 0;
int ss[100];

int main(){
  int x, ans;
  int n1, n2, num;
  char s[100];

  while(scanf("%s", s) != EOF){
    if(s[0] == '+'){
      n1 = pop();
      n2 = pop();
      num = n1 + n2;
      push(num);
    }else if(s[0] == '-'){
      n1 = pop();
      n2 = pop();
      num = n2 - n1;
      push(num);
    }else if(s[0] == '*'){
      n1 = pop();
      n2 = pop();
      num = n1 * n2;
      push(num);
    }else{
      x = atoi(s);
      push(x);
    }
  }
  ans = pop();
  printf("%d\n", num);

  return 0;
}

void push(int x){
  if(top >= MAX - 1){
    printf("overfullow\n");
  }
  top++;
  ss[top] = x;
}

int pop(void){
  if(top == 0){
    printf("underfullow\n");
  }
  top--;
  return ss[top+1];
}



Measured memory_bytes: 2032
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

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

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll n;
    cin >> n;

    if(n==1){
        cout << 0 << endl;
        return 0;
    }

    ll ans=0,all=1,no0or9=1,no09=1;
    for(ll i=0;i<n;i++){
        all=all*10%MOD;
        no0or9=no0or9*9%MOD;
        no09=no09*8%MOD;
    }

    ans=(all-2*no0or9+no09)%MOD;

    if(ans<0)ans+=MOD;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3604
import sys 
sys.setrecursionlimit(10**6)
def dp(n,cache,height):
  if n<0:
    return float('inf')
  elif n==0:
    return 0
  elif n==1:
    return abs(height[1]-height[0])
  elif n in cache :
    return cache[n]
  else:
    cache[n]= min(dp(n-1,cache,height)+abs(height[n]-height[n-1]),dp(n-2,cache,height)+abs(height[n]-height[n-2]))
    return cache[n]
n=int(input())
h=list(map(int,input().split()))
print(dp(n-1,dict(),h))


Measured memory_bytes: 172388
n = int(input())
li = list(map(int,input().split()))

from itertools import accumulate

lin = list(accumulate(li))
mi = 10**18
S = sum(li)

for i in range(n-1):
    ara = lin[i]
    sunu = S-ara
    mi = min(mi,abs(ara-sunu))

print(mi)

Measured memory_bytes: 24796
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			while (sc.hasNext()) {
				long x = sc.nextLong();
				long y = sc.nextLong();

				long gcd = gcd(x, y);
				long lcm = (x / gcd) * y;
				System.out.printf("%s %s\n", gcd, lcm);
			}
		}
	}
	public static long gcd(long a, long b) {
		while (a != b) {
			if (a > b) {
				a = a - b;
			} else {
				b = b - a;
			}
		}
		return a;
	}
}

Measured memory_bytes: 26304
#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  int x[100001];
  for(int i = 0 ; i < m; i++){
    cin >> x[i];
  }
  if(n >= m){
    cout << 0 << endl;
    return 0;
  }
  sort(x, x + m);
  int l[100000];
  for(int i = 0; i < m-1; i++){
    l[i] = x[i+1] - x[i];
  }
  sort(l, l+ m-1);
  int rest = 0;
  for(int i = m-n ; i < m-1 ; i++){
    rest += l[i];
  }
  int ans = x[m-1] - x[0] - rest;
  cout << ans << endl;
}


Measured memory_bytes: 1024
L,R = map(int,input().split())
ans = (L*(L+1))%2019
if R-L >= 2019:
    print(0)
    exit()
else:
    for i in range(L,R):
        for j in range(L+1,R+1):
            if ans > (i*j)%2019:
                ans = (i*j)%2019
print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

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; }
const int INF = (1 << 29);
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int main(int argc, char* argv[])
{
  string a, b, c;
  cin >> a >> b >> c;
  cout << a.at(0) << b.at(1) << c.at(2) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n;
  cin>>n;
  while(n--){
    string a,b;
    cin>>a>>b;
    if(a.size()<b.size())swap(a,b);
    while(a.size()!=b.size())b='0'+b;
    //cout<<a<<endl<<b<<endl;
    rep(i,a.size()){
      int tmp=a.size()-i-1;
      a[tmp]+=b[tmp]-'0';
      if(!tmp)break;
      if(a[tmp]>'9'){a[tmp]-=10;a[tmp-1]++;}
    }
    if(a[0]>'9'){a[0]-=10;a='1'+a;}
    if(a.size()>80)cout<<"overflow"<<endl;
    else cout<<a<<endl;
  }
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            //cout<<x<<"/"<<y;
            cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////


int main(){fastio
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll dp[c+1][d+1];memset(dp,0,sizeof(dp));
    dp[a][b]=1;
    rep(sum,a+b+1,c+d){
        rep(i,a,c){
            ll j=sum-i;
            if(j<b||j>d)continue;
            Add(dp[i][j],dp[i-1][j]*j);
            Add(dp[i][j],dp[i][j-1]*i);
            Add(dp[i][j],-dp[i-1][j-1]*(i-1)*(j-1));
        }
    }
    /*
    rep(i,0,c){
        rep(j,0,d){
            cout<<dp[i][j]<<" ";
        }cout<<endl;
    }cout<<endl;
    */
    cout<<mod(dp[c][d])<<endl;
    
    return 0;
}




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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

int N,C;
vpint lis[33];

int sum[222222];

signed main(){
    cin>>N>>C;
    rep(i,N){
        int a,b,c;cin>>a>>b>>c;
        c--;
        lis[c].pb({a,b});
    }

    rep(i,C){
        sort(all(lis[i]));
        vpint v;
        for(auto p:lis[i]){
            if(v.size()==0||v.back().se!=p.fi)v.pb(p);
            else v.back().se=p.se;
        }
        for(auto p:v){
            sum[p.fi*2-1]++;
            sum[p.se*2]--;
        }
    }

    rep(i,222222-1)sum[i+1]+=sum[i];
    cout<<*max_element(sum,sum+222222)<<endl;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define inv(n, a) for(int i = 0; i < n; i++) cin >> a[i]
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
    const int M = 300;
    vector<ll> v(M);
    rep(i, M){
        v[i] = pow(100-i, 5);
        // cout << i << " " << v[i] << endl;
    }
    ll x; cin >> x;
    int a, b;
    rep(i, M) {
        rep(j, M){
            if(v[i] - v[j] == x){
                a = 100-i; b = 100-j;
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 4112
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
int main()
{
	int n; cin >> n;
	string s; cin >> s;
	if(n % 2 == 0 && s.substr(0, n / 2) == s.substr(n / 2))
		cout << "Yes";
	else
		cout << "No";
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    vector<ll> x(N);
    vector<ll> cnt(101010, 0);
    REP(i, N) cin >> x[i];
    ll ma = -1;
    ll mi = (1ll << 60);
    REP(i, N) ma = max(x[i], ma);
    REP(i, N) mi = min(x[i], mi);
    REP(i, N){
    	if(x[i] == ma) cnt[ma]++;
    	if(x[i] == mi) cnt[mi]++;
    }
    if(ma - mi == 0){
    	if(ma == N-1 || 2*ma <= N){
    		cout << "Yes" << endl;
    	}else{
    		cout << "No" << endl;
    	}
    }else if(ma - mi == 1){
    	if(cnt[mi] < ma && 2*(ma - cnt[mi]) <= cnt[ma]){
    		cout << "Yes" << endl;
    	}else{
    		cout << "No" << endl;
    	}
    }else{
    	cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N = 1e5 + 5;
int arr [N][3];
int ans [N][3];
int main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for(int i =0;i<n;i++)
    for(int j =0;j<3;j++)
        cin>>arr[i][j];

  for(int i =0;i<3;i++)
    ans[0][i]=arr[0][i];
  for(int i = 1 ; i < n ; i++ )
  {
    for(int j = 0 ; j < 3 ; j++ )
      {
        int Max=0;
        for(int k = 0 ; k < 3 ; k++ )
          {
              if(j==k)
                continue;
              Max=max(Max,ans[i-1][k]);
          }
          ans[i][j] = Max + arr[i][j];
      }
  }
  int Max=0;
  for(int i = 0 ; i < 3 ; i++)
  {
    Max=max(Max,ans[n-1][i]);
  }
  cout<<Max;

  return 0;
}


Measured memory_bytes: 2560
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
      	String t = sc.next();
      	int slen = s.length();
      	int tlen = t.length();
      	int min = 10000;
      	for(int i=0;i<slen-tlen+1;i++){
          int count = 0;
          for(int j=0;j<tlen;j++){
            if( s.charAt(i+j) == t.charAt(j) ){
              count++;
            }
          }
          if( tlen - count < min ){
            min = tlen - count;
          }
        }
      System.out.println(min);
	}
}

Measured memory_bytes: 27056
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

bool solve(int i,int m);

int main(){
  int scount = 0;
  int tcount = 0;
  string s;
  cin >> s;
  int ss = s.size();
  int ans = ss;
  rep(i,ss){
    if(s[i] == 'T'){
      tcount++;
      while(tcount > 0 && scount > 0){
        ans -= 2;
        tcount--;
        scount--;
      }
    }
    if(s[i] == 'S'){
      scount++;
      tcount = 0;
    }
  }
  cout << ans << endl;
}




Measured memory_bytes: 640
#include <iostream>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>

using lli=long long int;

int main(){
  int N;
  std::cin >> N;

  std::vector<lli> A_arr(N), B_arr(N);
  for(int i = 0; i < N; i++) std::cin >> A_arr[i];

  lli xor_total = 0;
  for(int i = 0; i < N; i++) xor_total ^= A_arr[i];
  for(int i = 0; i < N; i++) B_arr[i] = A_arr[i] & (~xor_total);

  int nt = 0;
  for(int nd = 60; nd >= 0; nd--){
    lli ndi = 1LL<<nd;
    int i = nt;
    for(; i < N; i++) if(B_arr[i]&ndi) break;
    if(i == N) continue;
    std::swap(B_arr[nt], B_arr[i]);
    for(i = 0; i < N; i++){
      if(i == nt) continue;
      if(B_arr[i] & ndi) B_arr[i] ^= B_arr[nt];
    }
    nt++;
  }
  lli xor_partial = 0;
  for(int i = 0; i < N; i++) xor_partial ^= B_arr[i];

  std::cout << 2*xor_partial+xor_total << std::endl;

  return 0;
}



Measured memory_bytes: 1792
using System;
class Program{
	static void Main(){
		long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		string ans="NO";
		for(int i=0;i<=s[0]/2;i++){
			long a=(s[0]-i-1)*s[3]-i*s[4];
			long b=(s[0]-i-1)*s[4]-i*s[3];
			if(s[1]+a<=s[2]&&s[1]+b>=s[2]){ans="YES";break;}
			else if(s[1]-b<=s[2]&&s[1]-a>=s[2]){ans="YES";break;}
		}
		Console.WriteLine("{0}",ans);
	}
}

Measured memory_bytes: 13268
#include <iostream>
using namespace std;
int a[1000],b[1000],leng=0;
int f(){
    int i,j;
    for(i=1;i<=leng;i++)
    if(b[a[i]]>0)return 1;//判断是否是厌恶的数字
    return 0;
}
int main(){
    int i,j,l;
    long long k,n,m;
    cin>>k>>n;
    for(i=1;i<=n;i++)cin>>l,b[l]++;//此处用桶来记录，方便判断是否是厌恶的数字
    m=k;
    while(m>0){
        a[++leng]=m%10;
        m/=10;
    }//此处我们把k的每一位储存到数组当中去
    while(f()){
        int s1=f();//注意：一定要从第一位开始，因为之后会有变动，此处写s1=f()可以替换成s1=1
        a[s1]++;//那一位上的数字++
        k++;
        while(a[s1]>=10)a[s1]=0,s1++,a[s1]++;//注意：此处如果发现需要进位，那么就根据加法的原理
        leng=max(leng,s1);//注意！最高位如果有进位的情况，leng也要随之++，此处刚好利用s1一定是最高位的巧合
    }
    cout<<k<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
typedef map<ll, ll>    mp;
typedef pair<int, int>    pii;
typedef vector<ll>        vi;
typedef vector<pii>        vpii;
typedef vector<vi>        vvi;
const int m = 1000000007;
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

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

string s,t;
cin>>s>>t;
int minc=INT_MAX;

for(int i=0;i<=s.size()-t.size();i++){
	int count=0;
	string temp =s.substr(i,t.size());
	for(int j=0;j<t.size();j++){
		if(temp[j]!=t[j]){
			count++;
		}
	}
	minc=min(minc,count);
}
cout<<minc<<endl;
	return 0;
}

Measured memory_bytes: 3568
#include <stdio.h>
int main (void)
{
	int h=0;
	int kazu[10000];
	int syo;
	long long gou,dai;
	int k,d,s,g;

	scanf("%d",&h);//??±?????°????±???????

	for(k=0;k<h;k++)
	{
		scanf("%d",&kazu[k]);//???????????°?????\?????????
	}

	dai = kazu[0];
	syo = kazu[0];
	gou = 0;

	for(d=0;d<h;d++)//?????§???????±???????
	{
		if(dai<kazu[d])
		{
			dai=kazu[d];
		}
		else
		{
			dai = dai;
		}
	}

	for(s=0;s<h;s++)//????°????????±???????
	{
		if(syo>kazu[s])
		{
			syo = kazu[s];
		}
		else
		{
			syo = syo;
		}
	}

	for(g=0;g<h;g++)//????¨?????±???????
	{
		gou = gou + kazu[g];
	}

	printf("%d %d %ld\n",syo,dai,gou);//??????

	return 0;

}

Measured memory_bytes: 640
import sys
import numpy as np

A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]

TF = [[False, False, False] for _ in range(3)]
for b in B:
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                TF[i][j] = True

TF = (np.array(TF)).flatten()

C = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]])

for a, b, c in C:
    if TF[a] and TF[b] and TF[c]:
        print('Yes')
        sys.exit()

else:
    print('No')


Measured memory_bytes: 21532
#include <iostream>
#include <cmath>
using namespace std;

int main() {

int a,b,c,d,e;

cin >> a >> b >> c;

d=max(a,max(b,c));
e=min(a,min(b,c));

cout << e << " " << a+b+c-d-e << " " << d << endl;

}


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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;


int main(){
  string s,p,ss; cin >> s >> p;
  ss = s + s;
  int pos = ss.find(p);
  if (pos == string::npos) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }  
}



Measured memory_bytes: 3232
#include <stdio.h>
#include <string.h>

int chain(char *s);

int main(){

	int n;
	char str[10002];
	int a;
	char strbak[10002];
	int min,l;
	int i;
	char *p;
	char c;
	
	while(1){
		scanf("%d\n",&n);
		if(!n)break;
		i=0;
		for(i=0;i<n;i++){scanf("%d\n",&a);str[i]='1'+(a-1);}
		str[i]='\0';
		strcpy(strbak,str);
//printf("%s\n",str);		
		min=strlen(str);
		for(p=str;*(p+3);p++){
			if(*(p+1)==*(p+2)&&*(p+2)==*(p+3)){
				c=*p;*p=*(p+1);l=chain(str);if(l<min)min=l;
				*p=c;
			}
			if(*p==*(p+2)&&*(p+2)==*(p+3)){
				c=*(p+1);*(p+1)=*p;l=chain(str);if(l<min)min=l;
				*(p+1)=c;
			}
			if(*p==*(p+1)&&*(p+1)==*(p+3)){
				c=*(p+2);*(p+2)=*p;l=chain(str);if(l<min)min=l;
				*(p+2)=c;
			}
			if(*p==*(p+1)&&*(p+1)==*(p+2)){
				c=*(p+3);*(p+3)=*p;l=chain(str);if(l<min)min=l;
				*(p+3)=c;
			}
		}
		
		printf("%d\n",min);
		
	}
	return 0;
}


int chain(char *s){
//printf("in %s\n",s);
	char ss[10002];
	int len,d;
	char *p,*q;
	int i;
	char c;
	strcpy(ss,s);
	if((p=strstr(ss,"1111"))!=NULL){
		q=p;
		while(*q==*p)q++;
	}else if((p=strstr(ss,"2222"))!=NULL){
		q=p;
		while(*q==*p)q++;
	}else if((p=strstr(ss,"3333"))!=NULL){
		q=p;
		while(*q==*p)q++;
	}
//printf("%s\t",ss);printf("p=%d\tq=%d\tq-p=%d\n",p-ss,q-ss,q-p);	
	d=q-p;
	while(p>ss && q<&ss[strlen(ss)]){
		p--;
		c=*p;
		if(*q!=c)break;
		while(p>=ss && *p==c)p--;
		p++;
		while(q<&ss[strlen(ss)] && *q==c)q++;
		if(q-p<d+4)break;
		d=q-p;
//printf("%s\t",ss);printf("p=%d\tq=%d\tq-p=%d\n",p-ss,q-ss,q-p);	
	}
	
	return strlen(ss)-d;

}

Measured memory_bytes: 648
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
    char a[8];
	long long h,l,n;
	cin>>n;
	for(int k=0;k<n;k++){
		for(int j=0;j<8;j++)
			cin>>a[j];
		for(int i=0;i<7;i++){
            for(int j=7;j>i;j--){
	            if(a[j]<a[j-1]){
	            int tmp=a[j];
	            a[j]=a[j-1];
	            a[j-1]=tmp;
	            }
            }
        }
		h=0,l=0;
		for(int j=0;j<8;j++){
			double t=j;
			l+=a[j]*pow(10,7-t);
			h+=a[7-j]*pow(10,7-t);
		}
		cout<<h-l<<endl;
	}
	return 0;
}

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

int main() {

	ll n; cin >> n;
	vector<ll> l(n);
	for (ll i = 0; i < n; i++) {
		cin >> l[i];
	}
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		for (ll j = i + 1; j < n; j++) {
			for (ll k = j + 1; k < n; k++) {
				if (i == j) continue;
				if (j == k) continue;
				if (l[i] == l[j]) continue;
				if (l[j] == l[k]) continue;
				if (l[k] == l[i]) continue;
				if (l[i] + l[j] <= l[k]) continue;
				if (l[j] + l[k] <= l[i]) continue;
				if (l[k] + l[i] <= l[j]) continue;
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           PI;
typedef pair<ll,ll>             PL;
typedef vector<PI>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;
typedef vector<ll>              vl;
typedef vector<vl>              vvl;








int main (){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> num(100001);
    REP(i,n){
        cin >> a[i];
        num[a.at(i)]++;
    }

    int max = 0;
    REP(i, 100000){
        if(i>0){
            if(max < num[i] + num[i+1] + num[i-1]){
                max = num[i] + num[i+1] + num[i-1];
            }
        }
        else if(max < num[i] + num[i+1]){
            max = num[i] + num[i+1];
        }
    }
    


    cout << max << endl;





    return 0;
}

Measured memory_bytes: 1024
#define PI 3.14159265359
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 1; i < (n + 1); ++i)
using namespace std;
using ll = long long;
using p = pair<int, int>;
double r;

int main() {
	cin >> r;
	cout << r * 2 * PI;
	return 0;
}


Measured memory_bytes: 3788