akhauriyash/Code-Regression huggingface dataset:
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.readline
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
from itertools import combinations

def run():
    N, K = map(int, sysread().split())
    niku = []
    for i in range(N):
        niku.append([i]+list(map(int, sysread().split())))

    high_t = math.sqrt(2000**2 + 2000**2) * 101
    low_t = 0
    current = (high_t + low_t) / 2
    delta = 5e-7
    if K == 1:
        print(0)
        return None

    while high_t - low_t > delta:
        done = False
        c = [(current / ci) ** 2 for _, _, _, ci in niku]
        for i, xi, yi, _ in niku:
            if done:
                break
            K0 = 0
            for k, xk, yk, _ in niku:
                if done:
                    break
                ck = c[k]
                if ((xi - xk) ** 2 + (yi - yk) ** 2) <= ck + delta:
                    K0 += 1
                if K0 >= K:
                    done = True


        for (i, xi, yi, _), (j, xj, yj, _) in combinations(niku, 2):
            if done:
                break
            ci, cj = c[i], c[j]
            xj -= xi
            yj -= yi
            d2 = xj ** 2 + yj ** 2
            d = math.sqrt(d2)

            x = (d2 + ci - cj) / (2 * d)
            e = ci - x ** 2
            if e < 0 or math.sqrt(ci) + math.sqrt(cj) < d:
                continue
            else:
                e = math.sqrt(e)

            vx1, vy1 = xj / d, yj / d
            vx2, vy2 = yj / d, -xj / d

            X1 = vx1 * x + vx2 * e + xi
            X2 = vx1 * x - vx2 * e + xi
            Y1 = vy1 * x + vy2 * e + yi
            Y2 = vy1 * x - vy2 * e + yi

            K1 = 0
            K2 = 0

            for k, xk, yk, _ in niku:
                if done:
                    break
                ck = c[k]
                if ((xk - X1) ** 2 + (yk - Y1) ** 2) <= ck + delta:
                    K1 += 1
                if ((xk - X2) ** 2 + (yk - Y2) ** 2) <= ck + delta:
                    K2 += 1
                if K1 >= K or K2 >= K:
                    done = True


        if done:
            high_t = current
            current = (high_t + low_t) / 2
        else:
            low_t = current
            current = (high_t + low_t) / 2

    print((low_t + high_t) / 2)
    return None

if __name__ == "__main__":
    run()

Measured memory_bytes: 3192
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int [] in = new int [a];
        for(int i=0;i<a;i++){
                             in[i] = sc.nextInt();
                            }
        int count = 0;
		int ans = 0;
        for(int i=0;i<a-1;i++){if(in[i]>=in[i+1]){count++;}
                               else{ans = Math.max(ans,count);
                                   count=0;
                                   }
                               if(i==a-2){ans = Math.max(ans,count);}
                              }       
		System.out.println(ans);
	}
}


Measured memory_bytes: 50460
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
// #define LOCAL
const int MAXN=3010;
const ll MOD=998244353;
ll _gcd(ll a,ll b){if(b==0)return a;return _gcd(b,a%b);}
ll gcd(ll a,ll b){a=abs(a),b=abs(b);if(a<b)swap(a,b);return _gcd(a,b);}
ll qpow(ll a,ll n){ll rt=1;while(n){if(n&1)rt=(rt*a)%MOD;a=a*a%MOD;n>>=1;}return rt;}
ll factor[MAXN];
void cal_factor(){factor[0]=1;for(int u=1;u<MAXN;u++){factor[u]=(factor[u-1]*u)%MOD;}}
ll C(ll n,ll k){return factor[n]*qpow(factor[n-k],MOD-2)%MOD*qpow(factor[k],MOD-2)%MOD;}
int N,S;
int A[MAXN];
ll dp[MAXN][MAXN];
void solve()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>S;
    for(int u=1;u<=N;u++)cin>>A[u];
    dp[0][0]=1;
    for(int u=1;u<=N;u++){
        for(int v=0;v<=S;v++){
            dp[u][v]=(dp[u][v]+2*dp[u-1][v]%MOD)%MOD;
            if(v>=A[u]){
                dp[u][v]=(dp[u][v]+dp[u-1][v-A[u]])%MOD;
            }
        }
    }
    cout<<dp[N][S];
}
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    solve();
}

Measured memory_bytes: 74172
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {

            string N = Console.ReadLine();
            string[] V = Console.ReadLine().Split();
            string[] C = Console.ReadLine().Split();

            int ret = 0;
            for (var i = 0; i < int.Parse(N); i++)
            {
                var v = int.Parse(V[i]);
                var c = int.Parse(C[i]);

                if (v > c)
                {
                    ret += v - c;
                }
            }


            Console.WriteLine(ret);
        }


    }
}


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

long long test(long long tmp, long long K) {
  long long ans = abs(tmp - K);
  if (ans >= tmp) return tmp;
  else return ans;
}

int main() {
  long long N, K; cin >> N >> K;
  long long t = N / K;
  long long ans = N - K * t;
  long long tmp = test(ans, K);

  while (true) {
    if (ans >= tmp) {
      ans = tmp;
      break;
    }
    tmp = ans;
    ans = test(ans, K);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
typedef long long ll;
const int maxn=2e5+7;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;

int a[maxn];
ll sum[maxn];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m,v,p;
    cin>>n>>m>>v>>p;
    for(int i=1;i<=n;++i) cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=1;i<=n;++i)
        sum[i]=sum[i-1]+a[i];
    int ans=p;
    for(int i=n-p;i>=1;--i)
    {
        if(a[i]+m<a[n-p+1]) break;
        else
        {
            if( m*v<=i*m+(p-1)*m+(a[i]+m)*(n-p+1-i)-(sum[n-p+1]-sum[i]) )
                ans++;
            else break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1408
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())


class UnionFind:
    def __init__(self, N):
        self.parent = list(range(N + 1))
        self.size = [1] * (N + 1)

    def __getitem__(self, x):
        parent = self.parent
        while parent[x] != x:
            parent[x] = parent[parent[x]]
            x = parent[x]
        return x

    def merge(self, x, y):
        x = self[x]
        y = self[y]
        if x == y:
            return
        sx, sy = self.size[x], self.size[y]
        if sx < sy:
            x, y = y, x
            sx, sy = sy, sx
        self.parent[y] = x
        self.size[x] += sy


uni = UnionFind(N)
for i in range(M):
    a, b = map(int, input().split())
    uni.merge(a, b)


max_size = 0
for i in range(1, N+1):
    max_size = max(max_size, uni.size[i])

print(max_size)


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

#define REP(i, start, count) for (int i = (start); i < (int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

const double PI = 3.14159265358979323846;

int R;

int main(void)
{
    cin >> R;
    
    cout << fixed << setprecision(16) << 2 * R * PI << endl;
    return 0;
}

Measured memory_bytes: 3784
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・項数、和 -> 通り数 を持ってdp
"""

import numpy as np

N,K,*A = map(int,read().split())

MOD = 10**9 + 7

dp = np.zeros((N+1,256),np.int64)
dp[0,0] = 1
for x in A:
    dp[1:,np.arange(256)^x] += dp[:-1]
    dp %= MOD

fact = np.ones(N+1,np.int64)
for n in range(1,N+1):
    fact[n] = fact[n-1] * n % MOD

answer = (fact * dp[:,K] % MOD).sum() % MOD
print(answer)

Measured memory_bytes: 12952
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<n; ++i)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define F first
#define S second
#define PB push_back
#define MP make_pair 
using namespace std;
typedef unsigned long ul;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef pair<int, int> pi;
const int INF = 100100100;
const unsigned int MOD = 1000000007;

bool is_prime(int n) { for (int i = 2; i*i <= n; ++i) { if (n % i == 0) return false; } return true; }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }

// メモ化再帰
int rec(int n) {
}

int main() {
    
    for(;;) {
        ll dp[35];
        REP(i, 35) dp[i] = INF;
        dp[0] = 1;
        dp[1] = 2;
        dp[2] = 4;
        
        int N; cin >> N;
        if(N == 0) break;
        
        for(int i = 3; i < N; ++i) {
            dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]; 
        }
        
        cout << dp[N - 1]/10/365 + 1 << endl;
        
    }
}


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

typedef long long ll;
typedef pair<int, int> ii;

int n;
string s;
const int N = 4001;
int R[N];
int G[N];
int B[N];

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

  int r = 0, g = 0, b = 0;
  for (int i = 0; i < n; ++i) {
    R[i] = r;
    G[i] = g;
    B[i] = b;
    if (s[i] == 'R') {
      ++r;
    } else if (s[i] == 'G') {
      ++g;
    } else {
      ++b;
    }
  }
  ll res = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'R') {
      res += (G[i] * (b - B[i]));
      res += (B[i] * (g - G[i]));
    } else if (s[i] == 'G') {
      res += (R[i] * (b - B[i]));
      res += (B[i] * (r - R[i]));
    } else {
      res += (R[i] * (g - G[i]));
      res += (G[i] * (r - R[i]));
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int len = 1; i + len + len < n; ++len) {
      if (s[i] != s[i + len] && s[i] != s[i + len + len] &&
          s[i + len] != s[i + len + len]) {
        res--;
      }
    }
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    int K;
    cin >> K;
    // A < B
    // B <  C
    while(B <= A) {
        B *= 2;
        K -= 1;
        if(K < 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    while(C <= B) {
        C *= 2;
        K -= 1;
        if(K < 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <math.h>
using namespace std;

int main(void){
    int k, x;

    cin >> k >> x;

    int mini = x - k + 1;
    int maxi = x + k - 1;
    for(int i = mini; i <= maxi; i++){
        cout << i << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
//static const long double pi = 3.1415926535897932;

using namespace std;
using ll = long long int;
using ull = unsigned long long;

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) { // nCr の計算
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

int main() {
	vector<int> n(4);
	vector<int> f(4); // 0:1, 1:4, 2:7, 3:9
	for (int i = 0; i < 4; i++) {
		f[i] = 0;
	}
	bool flag = false;
	for (int i = 0; i < 4; i++) {
		cin >> n[i];
		switch(n[i]) {
			case 1:
				f[0]++;
				break;
			case 4:
				f[1]++;
				break;
			case 7:
				f[2]++;
				break;
			case 9:
				f[3]++;
				break;
			default:
				flag = true;
				break;
		}
	}
	if (flag) {
		cout << "NO" << endl;
	} else {
		for (int i = 0; i < 4; i++) {
			if (f[i] != 1) {
				cout << "NO" << endl;
				return 0;
			} 
		}
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int S=0;
  cin>>N;
  vector<int>vec(N);
  for(int X=0;X<N;X++){
    cin>>vec.at(X);
    if(X>0 && vec.at(X-1)==vec.at(X)){
       vec.at(X)='10001';
       S++;
    }
  }
  cout<<S<<endl;
}

Measured memory_bytes: 3616
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

def main():
    N, K = map(int, input().split())
    D = input().split()
    i = N
    while True:
        if len(set(str(i)).intersection(D)) == 0:
            print(i)
            break
        i += 1

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=3005,INF=1<<29;
typedef string::const_iterator State;

int expr(State &begin);
int term(State &begin);
int factor(State &begin);
int number(State &begin);

int expr(State &begin){
    int ret=term(begin);
    
    for(;;){
        if(*begin=='+'){
            begin++;
            ret+=term(begin);
        }else if(*begin=='-'){
            begin++;
            ret-=term(begin);
        }else break;
    }
    
    return ret;
}

int term(State &begin){
    int ret=factor(begin);
    
    for(;;){
        if(*begin=='*'){
            begin++;
            ret*=factor(begin);
        }else if(*begin=='/'){
            begin++;
            ret/=factor(begin);
        }else break;
    }
    
    return ret;
}

int factor(State &begin){
    if(*begin=='('){
        begin++;
        int ret=expr(begin);
        begin++;
        return ret;
    }else{
        return number(begin);
    }
}

int number(State &begin){
    int ret=0;
    
    while(isdigit(*begin)){
        ret*=10;
        ret+=(*begin-'0');
        begin++;
    }
    
    return ret;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    for(int i=0;i<N;i++){
        string S;cin>>S;
        State a=S.begin();
        cout<<expr(a)<<endl;
    }
}



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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */

int main(){
    map<int, int> sheet;
    rep(i, 9){
        int x; cin >> x;
        sheet[x] = i + 1;
    }

    int n; cin >> n;
    bool op[9];
    rep(i, 9) op[i] = false;
    rep(i, n){
        int x; cin >> x;
        if(sheet[x] == 0) continue;
        op[sheet[x] - 1] = true;
    }

    bool isok = false;
    rep(i, 3){
        if(op[i*3] && op[i*3+1] && op[i*3+2]) isok = true;
        if(op[i] && op[i+3] && op[i+6]) isok = true;
    }

    if(op[0] && op[4] && op[8]) isok = true;
    if(op[2] && op[4] && op[6]) isok = true;

    yn(isok);
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
//const int inf = 1e9; //1(1倍)e(指数)9(10^9)
//const ll MX = 1e18; //1(1倍)e(指数)18(10^18)
//const ll MOD = 1e9 + 7; //1000000007で割った余りを聞かれたら使う
//加算代入演算子は+=
//int 2^31 10^9まで
//intは10桁、long longは18桁、doubleは308桁、long double は4932桁
//10^10くらいまででdoubleは誤差が発生しちゃう。なるべく整数にすること
//doubleからlong longにキャストするときは、+0.5で切り捨ての誤差を調整
//__int128()で128bit対応の整数（多倍長整数）
//||は片方が成り立つとき
int main()
{
    ll H, W;
    cin >> H >> W;

    ll ans = H * W;
    ll s[3];
    for (int i = 0; i < 2; ++i) //2回繰り返す
    {
        for (ll h = 1; h < H; ++h)
        {
            // まずは縦割り
            s[0] = h * W; //最初の分割部分
            s[1] = (H - h) * (W / 2); //余ったところを分割
            s[2] = H * W - (s[0] + s[1]); //余ったところ
            sort(s, s + 3); //配列昇順ソート
            ans = min(ans, s[2] - s[0]); //max-minの結果を保持して比較してく
            // 次いで横割り
            s[0] = h * W;
            s[1] = ((H - h) / 2) * W;
            s[2] = H * W - (s[0] + s[1]);
            sort(s, s + 3);
            ans = min(ans, s[2] - s[0]);
        }
        // 板チョコを90度回す
        swap(H, W);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int f(int n) {
  int sum = 0;
  while (n) {
    sum += n%10;
    n /= 10;
  }
  return sum;
}

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

  if (N%10==0) {
    cout << 10 << endl;
  } else {
    cout << f(N) << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using ll = long long int;

ll mod = 1000000007;

int main(){
    ll N, K;
    cin >> N >> K;
    ll sum1=0; ll sum2=0;
    for(ll i=K; i<N+2; i++){
        sum1 += N*i-i*i+i+1;
        sum1 %= mod;
    }
    cout << sum1;
}

Measured memory_bytes: 3620
using System;
class Program
{
	static void Main(string[] args)
	{
		double input = double.Parse(Console.ReadLine());
		double kari = Math.Floor(input / 1.08);
        
      
		if (Math.Floor(kari * 1.08) != input)
        {
            if (Math.Floor((kari + 1) * 1.08) != input)
            {
                Console.WriteLine(":(");
                return;
            }
            else
            {
                kari = kari + 1;
            }
        }
      
      Console.WriteLine(kari);
	}
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    map<string,int>memo;
    for(int i=0;i<N;++i){
        string S;
        cin>>S;
        memo[S]++;
    }
    int maxv=0;
    for(auto p:memo) maxv=max(p.second,maxv);
    for(auto p:memo){
        if(p.second != maxv)continue;
        else cout<<p.first<<endl;
    }
}

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

const int maxn = 200005;

int n;
long long k, l, r, m;
int a[maxn];

long long f (long long x) {
	long long res = 0LL;
	for (int i = 0; i < n; ++i) {
		long long t = a[i];
		if (t > x) {
			if (t > 2LL * x) {
				res += (t - x - 1LL) / x;
				t = 2LL * x;
			}
			++res;
		}
	}
	return res;
}

signed main () {
	scanf("%d %lld", &n, &k);
	for (int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	l = 1, r = 1000000000;
	while (r - l > 1) {
		m = (l + r) / 2;
		if (f(m) <= k)
			r = m;
		else
			l = m;
	}
	if (f(l) <= k) 
		printf("%lld\n", l);
	else
		printf("%lld\n", r);
}


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

int main() {
  int N;
  int ac = 0;
  int wa = 0;
  int tle = 0;
  int re = 0;
  cin >> N;
  for(int i = 0; i < N; i++) {
    string temp;
    cin >> temp;
    switch(temp[0]) {
      case 'A' : ac++; break;
      case 'W' : wa++; break;
      case 'T' : tle++; break;
      case 'R' : re++; break;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
  return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
#include <assert.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define SZ 666666
int n,x;
ll b[SZ],l[SZ],u[SZ];
pair<ll,ll> tw[SZ];
bool ok(ll t)
{
	ll fu=t/x,nf=t%x;
	if(fu>=n) return 1;
	ll tt=0;
	for(int i=1;i<=n;++i)
	{
		ll ns=-l[i]*b[i],fs=u[i]*(x-b[i]);
		tt+=ns;
		ll nff=max(l[i]*(nf-b[i]),u[i]*(nf-b[i]));
		tw[i]=mp(fs-ns,nff-ns);
	}
	sort(tw+1,tw+1+n);
	reverse(tw+1,tw+1+n);
	ll sb=0,ans=-8e18;
	for(int i=1;i<=fu+1;++i) sb+=tw[i].fi;
	for(int i=1;i<=n;++i)
	{
		if(i<=fu+1) ans=max(ans,sb-tw[i].fi+tw[i].se);
		else ans=max(ans,sb-tw[fu+1].fi+tw[i].se);
	}
	return ans+tt>=0;
}
int main()
{
	scanf("%d%d",&n,&x);
	for(int i=1;i<=n;++i)
		scanf("%lld%lld%lld",b+i,l+i,u+i);
	ll L=0,R=1e11;
	while(L<R)
	{
		ll M=(L+R)>>1;
		if(ok(M)) R=M; else L=M+1;
	}
	cout<<L<<"\n";
}


Measured memory_bytes: 9984
import std.stdio, std.conv, std.string, std.algorithm, std.math, std.array, std.container;

void main() {
  int n, r;
  readf("%d %d\n", &n, &r);
  int ir;
  if(n < 10) ir = r + 100*(10-n);
  else ir = r;
  writeln(ir);
}



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

int main() {
	string s, t;
	cin >> s;
	cin >> t;
	int cnt = 1;
	int *a = new int[s.length()];
	int *b = new int[t.length()];
	a[0] = 0;
	b[0] = 0;
	for (int i = 1; i < s.length(); i++) {
		for (int j = 0; j < i; j++) {
			if (s[i] == s[j]) {
				a[i] = a[j];
				goto label1;
			}
		}
		a[i] = cnt++;
	label1:;
	}
	cnt = 1;
	for (int i = 1; i < t.length(); i++) {
		for (int j = 0; j < i; j++) {
			if (t[i] == t[j]) {
				b[i] = b[j];
				goto label2;
			}
		}
		b[i] = cnt++;
	label2:;
	}
	for (int i = 0; i < s.length(); i++) {
		//cout << a[i] << " " << b[i] << endl;
		if (a[i] != b[i]) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 2312
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,k,zc=0,nc=0,pc=0,l,r,h,cnt=0,e,cnt1=0;
  cin >> n >> k;
  vector<ll> a(n),ne,po;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i]<0) ne.push_back(a[i]);
    else if(a[i]>0) po.push_back(a[i]);
    else zc++;
  }
  nc = ne.size(); pc = po.size();
  if(nc*pc>=k){
    l = -1200000000000000000;
    r = 0;
    sort(po.begin(),po.end(),greater<ll>());
    sort(ne.begin(),ne.end(),greater<ll>());
    while(r-l>1){
      h = (r+l)/2;
      e = 0;
      cnt = 0;
      for(int i=0;i<nc;i++){
        while(e<pc&&ne[i]*po[e]<h){
          e++;
        }
        cnt += e;
      }
  //    cout << h <<" "<<cnt<<endl;
      if(cnt<=k-1){
        l = h;
      }else{
        r = h;
      }
    }
    cout << l << endl;
    return 0;
  }
  k -= nc*pc;
  if(zc*(n-zc)+(zc*(zc-1))/2>=k){
    cout << 0 << endl;
    return 0;
  }
  k -= zc*(n-zc)+(zc*(zc-1))/2;
  l = 0;
  r = 1100000000000000000;
  for(auto& v:ne) v*=-1;
  sort(po.begin(),po.end());
  sort(ne.begin(),ne.end());
  while(r-l>1){
    h = (r+l)/2;
    cnt = 0;
    cnt1 = 0;
    e = 0;
    for(int i=pc-1;i>=0;i--){
      while(e<pc&&po[e]*po[i]<h){
        e++;
      }
      cnt += e;
      if(po[i]*po[i]<h) cnt--;
    }
    e = 0;
    for(int i=nc-1;i>=0;i--){
      while(e<nc&&ne[e]*ne[i]<h){
        e++;
      }
      cnt1 += e;
      if(ne[i]*ne[i]<h) cnt1--;
    }
    cnt /= 2;
    cnt1/= 2;
    if(cnt+cnt1<=k-1){
      l = h;
    }else{
      r = h;
    }
  }
  cout << l << endl;
}


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    double t,x;
    cin>>t>>x;
    cout<<fixed<<setprecision(10);
    cout<<t/x<<endl;
}

Measured memory_bytes: 3760
lines = readlines.map(&:strip)

n, d = lines.shift.split.map(&:to_i)

problems = lines.map{|line|line.split.map(&:to_i)}

#p [n, d, problems].inspect

# I need calculate rest count with biggest problems after current point
def count_problems_in_rest(complete_solving_arr, problems, goal)
  diff = goal - points_with_solved(complete_solving_arr, problems)
  return 0 if diff<0

  last_index = complete_solving_arr.zip((1..complete_solving_arr.count).to_a).keep_if{|e|e[0]==0}.last&.last.to_i
  max_points_in_rest = last_index*100
  return 0 if last_index == 0

  require_count = (diff.to_f/max_points_in_rest.to_f).ceil
  return Float::INFINITY if require_count > problems[last_index-1][0]
  require_count
end

# calculate point with current solving array
def points_with_solved(complete_solving_arr, problems)
  complete_solving_arr.zip(problems).map.with_index {|solve_problem, index|
    solve= solve_problem[0]
    problem = solve_problem[1]
    if(solve==1)
      100*(index+1)*problem[0]+problem[1]
    else
      0
    end
  }.inject(:+)
end

def count_with_solved(solvings, problems)
  solvings.zip(problems).keep_if{|e|e[0]==1}.map{|e|e[1][0]}.inject(:+).to_i
end

def recursive_count(solvings, problems, goal)
  # end condition
  if solvings.length==problems.length
    current_points = points_with_solved(solvings, problems)
    count = count_with_solved(solvings, problems)
    additional_count = count_problems_in_rest(solvings, problems, goal)

#p [count+additional_count, solvings]

    return count+additional_count
  end

  # recursive condition
  return [
    recursive_count(solvings.dup.push(0), problems, goal), 
    recursive_count(solvings.dup.push(1), problems, goal)
  ].min
end


#puts points_with_solved([0,1], problems)
#puts count_problems_in_rest([0,1], problems, 7000).inspect

p recursive_count([], problems, d)


Measured memory_bytes: 1916
#include <bits/stdc++.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int, int> pi;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MKP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
const int INF = 999999;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll MOD = 1000000007;
 
int N,ans = 0;
int main()
{
    cin >> N;
    REP(i,N+1){
       if(i%2==0||i==0){
            continue;
        }
        int temp = 0;
        REP(j,i){
            if(i%(j+1) == 0){
                temp++;
            }
        }
        if(temp == 8){
            ans++;
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*- 
def main():
    N, M, C = map(int, input().split())
    B = list(map(int, input().split()))
    cnt = 0
    for i in range(N):
        sum = 0
        A = list(map(int, input().split()))
        for j in range(M):
            sum += A[j]*B[j]
        # print(sum+C)
        if sum + C > 0:
            cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()

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

int main(void){
    
    int n , t , count , i , j ;
    int num[10000] ;
    
    scanf("%d" , &n) ; 
    
    for(i = 0 ; i < n ; i++){
        scanf("%d" , &num[i]) ;
    }
    count = n ;
    
    for(i = 0 ; i < n ;i++){
        if(num[i] == 2){
        }
        else if(num[i] % 2 == 0){
            count-- ;
        }
        else{
            t = sqrt(num[i]) ;
            for(j = 3 ; j <= t ; j = j + 2){
                if(num[i] % j == 0){
                count-- ;
                break ;
                }
            }
        }
    }
    printf("%d\n" , count) ;
    return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for(ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for(ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for(ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 2e9
using namespace std;
typedef long long ll;

int main() {
  int k;
  string s;
  cin >> k;
  cin >> s;

  if (SIZE(s) <= k) {
    cout << s << endl;
  } else {
    cout << s.substr(0, k) << "..." << endl;
  }

  return 0;
}

Measured memory_bytes: 3624
n,m=map(int,input().split())
ab=[[0]*2 for _ in range(m)]
for i in range(m):
  ab[i][1],ab[i][0]=map(int,input().split())
ab.sort()
cnt=0
num=0
for i in range(m):
  if ab[i][1]<=num:
    continue
  else:
    cnt+=1
    num=ab[i][0]-1
print(cnt)

Measured memory_bytes: 20016
N = gets.to_i
S = N.times.map { gets.chomp }

counter = []

S.each do |s|
  cnt = Hash.new(0)

  s.each_char do |c|
    cnt[c] += 1
  end

  counter << cnt
end

list = counter[0]

(1...N).each do |i|
  l = counter[i]

  ('a'..'z').each do |c|
    list[c] = [list[c], l[c]].min
  end
end

ans = ''

('a'..'z').each do |c|
  ans << c * list[c]
end

puts ans


Measured memory_bytes: 1916
import java.util.InputMismatchException;
import java.util.Scanner;

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

            int n = scan.nextInt();
            int answer;
            if (n % 2 == 0) {
                answer = n;
            } else {
                answer = n * 2;
            }
            System.out.println(answer);
        } catch (InputMismatchException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 22740
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int numA = 0;
		int numB = 0;
		int temp = 0;
		ArrayList<Integer>listA = new ArrayList<Integer>();
		ArrayList<Integer>listB = new ArrayList<Integer>();

		try(Scanner scan = new Scanner(System.in);) {
			while(true) {
				numA = scan.nextInt();
				numB = scan.nextInt();
				if(numA == 0 && numB == 0) {
					break;
				}

				if(numA > numB) {
					temp = numA;
					numA = numB;
					numB = temp;
				}

				listA.add(numA);
				listB.add(numB);
			}
			for(int i = 0; i < listA.size(); i++) {
				System.out.println(listA.get(i) + " " + listB.get(i));
			}
		}
	}
}

Measured memory_bytes: 37040
#include <bits/stdc++.h>
#define read(n) scanf("%lld",&n)
#define write(x) printf("%lld\n",x)
#define F(i,n) for(int i = 0;i < n;i++)
#define ll long long
#define MX 10005
#define MOD 1000000007
#define INF 1000000009
#define set_dp(dp) memset(dp,-1,sizeof(dp))
using namespace std;
ll d, dp[MX][105][2];
string a;
ll solve(ll i, ll j, bool leq){
	if(j < 0) j += d;
	if(i == -1) return j == 0;
	if(dp[i][j][leq] == -1){
		ll ans = 0;
		if(leq){
			F(digit, a[i] - '0'){
				ans += (solve(i - 1, (j - digit) % d , 0));
				ans %= MOD;
			}
			ans += solve(i - 1, (j - (a[i] - '0')) % d, 1);
			ans %= MOD;
		}
		else{
			F(digit, 10){
				ans += (solve(i - 1, (j - digit) % d, 0));
				ans %= MOD;
			}
		}
		dp[i][j][leq] = ans;
	}
	return dp[i][j][leq];
}
int main(){

	cin>>a>>d;
	reverse(a.begin(), a.end());

	ll ans = 0, n = a.size();

	set_dp(dp);

	ans = solve(n - 1, 0, 1) - 1;
	ans = (ans + MOD) % MOD;

	write(ans);

	return 0;
}


Measured memory_bytes: 17408
D, G = map(int, input().split())
p = []
c = []
for _ in range(D):
    p_i, c_i = map(int, input().split())
    p.append(p_i)
    c.append(c_i)
answer = 10 ** 10

for bit in range(2 ** D):
    score, solution_count, rest_max = 0, 0, 0
    for i in range(D):
        if bit & (1 << i):
            score += 100 * (i + 1) * p[i] + c[i]
            solution_count += p[i]
        else:
            rest_max = i + 1

    if score < G and rest_max:
        if (G - score) % (100 * rest_max) == 0:
            need_count = (G - score) // (100 * rest_max)
        else:
            need_count = (G - score) // (100 * rest_max) + 1
        if need_count > p[rest_max - 1]:
            continue
        else:
            score += 100 * rest_max * need_count
            solution_count += need_count

    if score >= G:
        answer = min(answer, solution_count)
print(answer)


Measured memory_bytes: 9156
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define int long long
#define pb push_back
#define mod 1000000007
#define setbits(x) __builtin_popcountll(x)
#define zerobits(x) __builtin_ctzll(x)
#define inf 1e18
#define pre(x,y) fixed<<setprecision(y)<<x
#define pq priority_queue<int>
#define mpq priority_queue<int,vector<int>,greater<int>>
#define gcd(x,y) __gcd(x,y)
#define mp make_pair

vector<vector<int>> multiply(vector<vector<int>> a,vector<vector<int>> b)
{
	int n=a.size();
	int i,j,k;
	vector<vector<int>> ans(n,vector<int>(n));
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			ans[i][j]=0;
			for(k=0;k<n;k++)
			{
				ans[i][j]=(ans[i][j]+a[i][k]*b[k][j])%mod;
			}
		}
	}
	return ans;
}



vector<vector<int>> power(vector<vector<int>> &mat,int n)
{
	if(n==1) return mat;
	vector<vector<int>> ans=power(mat,n/2);
	if(n&1) return multiply(mat,multiply(ans,ans));
	else return multiply(ans,ans);
}



int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k,i,j;
    cin>>n>>k;
    vector<vector<int>> mat(n,vector<int>(n));
    for(i=0;i<n;i++)
    {
    	for(j=0;j<n;j++) cin>>mat[i][j];
    }
    vector<vector<int>> ans=power(mat,k);
    int path=0;
    for(i=0;i<n;i++)
    {
    	for(int j=0;j<n;j++) path=(path+ans[i][j])%mod;
    }
    cout<<path<<endl;
	return 0;
}


Measured memory_bytes: 3764
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = input()
print('No' if s.count('A') == 3 or s.count('B') == 3 else 'Yes')

Measured memory_bytes: 5504
import collections
def main():
    n = int(input())
    s = []
    s_cnt = []
    len_min = 100
    min_idx = 0
    for i in range(n):
        ss = input()
        s.append(ss)
        cha = collections.Counter(list(ss))
        s_cnt.append(cha)
        if len_min > len(cha):

            len_min = min(len_min, len(cha))
            min_idx = i
    ans = []
    for i in range(97,97+26):
        alp = chr(i)
        tmp = [0] * n
        for j, cnt in enumerate(s_cnt):
            tmp[j] = cnt[alp]
        ans.append(min(tmp))
    ans_str = ''
    for i, num in enumerate(ans, 97):
        if num != 0:
            for j in range(num):
                ans_str += chr(i)
    print(ans_str)



if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
using DataStructures
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

const MOD = 10^9+7
function main()
  N,K = readint()
  A = readint()
  sort!(A)
  
  # 負, 0, 正の区間 
  # searchsorted が基本ですね
  L0 = searchsorted(A,0)
  Lm = 1:(L0.start-1)
  Lp = (L0.stop + 1):N
  
  # 負、0, 正の数
  Nm = length(Lm)
  N0 = length(L0)
  Np = length(Lp)

  if N0 > N-K
    println(0)
    return
  end

  if K == N
    s = 1
    for a in A
      s *= a
      s %= MOD
    end
    if s < 0
      s += MOD
    end
    println(s)
    return
  end

  
  if L0.stop == N
    s = 1
    if K%2 == 1 
      for i in N:-1:N-K+1
        s *= A[i]
        s %= MOD

      end
      if s < 0
        s += MOD
      end 
    else
      for i in 1:K
        s *= A[i]
        s %= MOD
      end
    end
    
  else
    s = 1
    if K%2 == 1
      s *= A[end]
    end
    B = Vector{int}(undef,N)
    B .= 0
    

    Nm = L0.stop
    NPm = Nm÷2 
    for i in 1:NPm
      B[i] = A[2i-1]*A[2i]
    end
    
    p = NPm + 1
    if K%2==1
      for i in N-1:-2:Nm+2
        B[p] = A[i]*A[i-1]
        p += 1
      end
    else
      for i in N:-2:Nm+2
        B[p] = A[i]*A[i-1]
        p += 1
      end
    end
      
    sort!(B,rev=true)
    #println(B)
    for i in 1:K÷2
      s *= B[i]%MOD
      s %= MOD
    end    

  end
  println(s)

  


end

main()

Measured memory_bytes: 217464
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  if (s.size() % 2 != 0) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < s.size(); i += 2) {
    if (s[i] != 'h' || s[i + 1] != 'i') {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)//iをaからn
#define per(i,a,n) for (int i=a-1;i>=n;i--)//iをnからa
#define db(x) cout << #x << " = " << x << endl
#define db2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; //デバッグ用
#define all(x) (x).begin(), (x).end()
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
 
 
//sort(all(a)); ソート
//sort(all(a),greater<int>()); 逆順ソート
 
int main() {
  long long int n;
  cin >>n;
  bool zoro1,zoro2,zoro3;
  zoro1=false;
  zoro2=false;
  zoro3=false;
int num1,num2;
rep(i,0,n){
    cin>>num1>>num2;
    if(num1!=num2){
        zoro1=false;
        zoro2=false;
    }else{
        if(zoro1){
            if(zoro2){
                zoro3=true;
            }else{
                zoro2=true;
            }
        }else{
            zoro1=true;
        }
    }
    //db2(zoro1,zoro2);
    //db(zoro3);
}


if(zoro3){
    cout<<"Yes";
}else{
    cout<<"No";
}

 return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N, D;
  cin >> N >> D;
  ll ans = 0;
  REP(i, N) {
    ll x, y;
    cin >> x >> y;
    if ((x * x) + (y * y) <= D * D)
      ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
	vector<char> c(9);
	REP(i,9) cin >> c.at(i);
	cout << c.at(0) << c.at(4) << c.at(8) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>


using namespace std;
#define MAX 500000

#define SENTINEL 2000000000

int L[MAX / 2 + 2], R[MAX / 2 + 2];

int cnt;


void merge(int A[], int n, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;

    for (int i = 0; i < n1; i++) L[i] = A[left + i];
    for (int i = 0; i < n2; i++) R[i] = A[mid + i];

    L[n1] = R[n2] = SENTINEL;

    int i = 0, j = 0;
    for (int k = left; k < right; k++) {
        cnt++;
        if (L[i] <= R[j]) {
            A[k] = L[i++];
        } else {
            A[k] = R[j++];
        }
    }

}

void mergeSort(int A[], int n, int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
    return;
}

int main() {
    int A[MAX], n, i;
    cnt = 0;

    cin >> n;
    for (i = 0; i < n; i++) cin >> A[i];


    mergeSort(A, n, 0, n);
    for (i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << A[i];
    }

    cout << endl;

    cout << cnt << endl;
    return 0;
}


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

#define int long long
#define ll long long
#define pb push_back

main(){
    int n;
    cin >> n;
    map<string, int> mp;
    for(int i = 0; i < n; i++){
        string h;
        cin >> h;
        mp[h]++;
    }
    cout << mp.size();
}


Measured memory_bytes: 19064
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, ans=0, nw=-1;
	vector<int> a, b, c;

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

	for(int i=1;i<=n;i++){
		ans+=b[i];
	}
	for(int i=1;i<n;i++){
		if(a[i]+1==a[i+1]) ans+=c[a[i]];
	}

	cout<< ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m,ans,man;
int a[55],b[55],c[55],d[55];
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++)cin>>a[i]>>b[i];
	for(int i=1;i<=m;i++)cin>>c[i]>>d[i];
	
	for(int i=1;i<=n;i++){
		int man=999999999;
		int ans=0;
		for(int j=1;j<=m;j++){
			if(man>abs(a[i]-c[j])+abs(b[i]-d[j])){
				man=abs(a[i]-c[j])+abs(b[i]-d[j]);
				ans=j;
			}
		}
		cout<<ans<<endl;
	}
}

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

int main() {
	int n, k;
	cin>>n>>k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin>>a[i];
	vector<int> dp(k+1);
	for (int i = 0; i < a[0]; i++) dp[i] = 1;
	for (int i = a[0] + 1, j = 1; i <= k; i++) {
		if (j < n && i == a[j]) {
			dp[i] = 0;
			j++;
			continue;
		}
		int w = 1;
		for (int l = 0; l < j; l++) {
			int ww = dp[i-a[l]];
			if (ww == 1) {
				w = 0;
				break;
			}
		}
		dp[i] = w;
	}
	if (dp[k] == 0) cout<<"First";
	else cout<<"Second";
	return 0;
}


Measured memory_bytes: 640