akhauriyash/Code-Regression huggingface dataset:
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n;
    string s;
    cin >> n >> s;
    int cnt = 0;
    for( int i = 0; i < 1000; ++i ) {
        int tmp = i;
        char c[3];
        c[0] = (tmp % 10) + '0'; tmp /= 10;
        c[1] = (tmp % 10) + '0'; tmp /= 10;
        c[2] = (tmp % 10) + '0';

        int p = 0;
        for( int i = 0; i < n && p < 3; ++i ) {
            if( c[p] == s[i] ) ++p;

        }
        if( p == 3 ) ++cnt;

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



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

using namespace std;

namespace mod {

template <class T, int M>
class MInt;

template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp);

template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n);

template <class T, int M>
class MInt {
  T n_;

 public:
  MInt() : n_(0) {}
  MInt(T n) : n_((n % M + M) % M) {}

  MInt &operator+=(const MInt &rhs) {
    n_ += rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }

  MInt &operator-=(const MInt &rhs) {
    n_ += M - rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }

    return *this;
  }

  MInt &operator*=(const MInt &rhs) {
    n_ = n_ * rhs.n_ % M;
    return *this;
  }

  MInt &operator/=(const MInt &rhs) { return (*this) *= Inv(rhs); }

  T Get() { return n_; }
};

template <class T, int M>
MInt<T, M> operator-(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res -= rhs;
}

template <class T, int M>
MInt<T, M> operator+(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res += rhs;
}

template <class T, int M>
MInt<T, M> operator*(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res *= rhs;
}

template <class T, int M>
MInt<T, M> operator/(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res /= rhs;
}

template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp) {
  if (exp == 0) {
    return 1;
  }

  auto a = Pow(base, exp / 2);
  a *= a;
  if (exp % 2 == 1) {
    a *= base;
  }

  return a;
}

template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n) {
  return Pow(n, static_cast<T>(M - 2));
}
}  // namespace mod

const int md = 998244353;
using MInt = mod::MInt<long long, md>;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<int> vd(n);
  bool invalid = false;
  for (int i = 0; i < n; i++) {
    cin >> vd[i];
    if ((i == 0 && vd[i] != 0) || (i != 0 && vd[i] == 0)) {
      invalid = true;
    }
  }

  if (invalid) {
    cout << 0 << '\n';
    return 0;
  }

  int max_d = *max_element(vd.begin(), vd.end());
  vector<long long> cnts(max_d + 1, 0);
  for (auto d : vd) {
    cnts[d]++;
  }

  MInt ans = 1;
  for (int i = 1; i < cnts.size() - 1; i++) {
    if (cnts[i] == 0) {
      ans = 0;
      break;
    }

    ans *= Pow(MInt(cnts[i]), cnts[i + 1]);
  }

  cout << ans.Get() << '\n';
  return 0;
}

Measured memory_bytes: 1408
#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 < (int)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 < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll dp[3][101010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    REP(i, 3)REP(j, 101010) dp[i][j] = 0;

    ll N, K;
    vector<ll> X(3);
    cin >> N >> K >> X[0] >> X[1] >> X[2];
    map<char, int> mp;
    mp['r'] = 0;
    mp['s'] = 1;
    mp['p'] = 2;
    string T;
    cin >> T;

    ll res = 0;
    for(int k=0;k<K;k++){
    	string A = "";
    	for(int i=0;K*i+k<N;i++){
    		A += T[K*i+k];
    	}
    	if(A.size()==0) break;
    	//cout << A << endl;

    	ll n = A.size();
    	REP(i, 3) REP(j, n+1) dp[i][j] = 0;
    	REP(i, 3) dp[i][0] = 0;
    	ll katsu = (mp[A[0]]-1+3)%3;
    	dp[katsu][0] = X[katsu];

    	REP(i, n-1){
    		REP(p, 3){
    			REP(q, 3){
    				if(p!=q){
    					ll katsu = (mp[A[i+1]]-1+3)%3;
    					ll next = dp[p][i] + (q==katsu ? X[q] : 0);
    					dp[q][i+1] = max(dp[q][i+1], next); 
    				}
    			}
    		}
    	}
    	ll ma = 0;
    	REP(i, 3) ma = max(ma, dp[i][n-1]);

    	/*
    	REP(i, 3){
    		REP(j, n){
    			cout << dp[i][j] << " ";
    		}
    		cout << endl;
    	}
    	*/

    	//dump(ma)
    	res += ma;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 2944
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

#n,m = [int(i) for i in readline().split()]
#d = [int(i) for i in readline().split()]

#n = int(input())
n,m = [int(i) for i in readline().split()]


if n==m:
    print("Yes")
else:
    print("No")











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

ll gcd(ll a, ll b){
  ll r = a%b;
  while(r > 0){
    a = b;
    b = r;
    r = a%b;
  }
  
  return b;
}

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

int main() {
  ll A,B,C,D;
  cin >> A >> B >> C >> D;
  //cout << gcd(A,B) << endl;
  ll num1 =  B - B/C - B/D + B/lcm(C,D);
  ll num2 = (A-1) - (A-1)/C - (A-1)/D + (A-1)/lcm(C,D);
  cout << num1 - num2 << endl;
  
  return(0);
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

pi operator+(const pi& l, const pi& r) {
    return {(l.f+r.f)%MOD,(l.s+r.s)%MOD};
}

pi operator-(const pi& l, const pi& r) {
    return {(l.f-r.f+MOD)%MOD,(l.s-r.s+MOD)%MOD};
}

pi operator*(const pi& l, const pi& r) {
    return {(ll)l.f*r.f%MOD,(ll)l.s*r.s%MOD};
}

pi base = mp(948392576,573928192), invbase = mp(499499562,829828935);

ll modpow(ll b, ll p) {
    return !p?1:modpow(b*b%MOD,p/2)*(p&1?b:1)%MOD;
}

ll inv(ll x) {
    return modpow(x,MOD-2);
}

int N;
string S;
pi sum[250001], cur[250001];
map<pi,int> tmp;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> S;
    
    cur[0] = {1,1};
    F0R(i,sz(S)) {
        char c = S[i];
        sum[i+1] = sum[i], cur[i+1] = cur[i];
        if (c == '+') sum[i+1] = sum[i]+cur[i];
        else if (c == '-') sum[i+1] = sum[i]-cur[i];
        else if (c == '<') cur[i+1] = cur[i]*base;
        else cur[i+1] = cur[i]*invbase;
    }
    ll ans = 0;
    F0Rd(y,sz(S)+1) {
        pi des = sum[sz(S)]*cur[y]+sum[y];
        if (tmp.count(des)) ans += tmp[des];
        tmp[sum[y]] ++;
    }
    cout << ans;
    // sum[x] = sum[sz(S)]*cur[y]+sum[y]
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 19988
use proconio::*;
use proconio::marker::Chars;
use std::cmp::min;

#[fastout]
fn run() {
    input! {
        t: usize,
    }
    for _ in 0..t {
        input! {
            n: usize,
            mut a: [usize; n],
            s: Chars,
        }
        let mut ans = 0;
        for (i, c) in s.into_iter().enumerate().rev() {
            let v = a[i];
            if v == 0 {
                continue;
            }
            if c == '1' {
                ans = 1;
            } else {
                for a in a.iter_mut().take(i) {
                    *a = min(*a, *a ^ v);
                }
            }
        }
        println!("{}", ans);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 2552
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

class UnionFind():
    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def unite(self, a, b):
        # set a's parent as b's parent
        r1 = self.root(a)
        r2 = self.root(b)
        if r1 == r2:
            return
        self.parent[r2] = r1

    def root(self, a):
        if self.parent[a] == a:
            return a
        par = self.root(self.parent[a])
        self.parent[a] = par
        return par

    def reroot(self):
        for ix, a in enumerate(self.parent):
            self.parent[ix] = self.root(a)
        return

def main():
    N, M = LI()
    P = LI_()
    X, Y = [], []
    uf = UnionFind(N)
    for _ in range(M):
        x, y = LI_()
        uf.unite(x, y)
    uf.reroot()
    groups = collections.defaultdict(set)
    for i, par in enumerate(uf.parent):
        groups[par].add(i)

    cnt = 0
    for _, g in groups.items():
        for ix in g:
            if P[ix] in g:
                cnt += 1
    print(cnt)
main()



Measured memory_bytes: 128028
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
struct _IO { _IO() { ios::sync_with_stdio(0); cin.tie(0); } }_io;
typedef long long ll; typedef long double db;

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

	if ((int)s.size() < 2)
	{
		cout << -1 << " " << -1 << endl;
		return 0;
	}

	for (int i = 0; i < (int)s.size() - 1; ++i)
	{
		if (s[i] == s[i + 1])
		{
			cout << i + 1 << " " << i + 2 << endl;
			return 0;
		}
	}

	for (int i = 0; i < (int)s.size() - 2; ++i)
	{
		if (s[i] == s[i + 2])
		{
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;

	return 0;
}

Measured memory_bytes: 3716
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;

        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while(st==null || !st.hasMoreElements()){
                try{
                    st=new StringTokenizer(br.readLine());
                }
                catch(IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt(){
            return Integer.parseInt(next());
        }

        Long nextLong(){
            return Long.parseLong(next());
        }

        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str="";
            try{
                str=br.readLine();
            }
            catch(IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String[] args) throws IOException {
       FastReader in = new FastReader();
       double r =in.nextDouble();
        System.out.println(2*Math.PI*r);
    }
}


Measured memory_bytes: 32992
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] line = sc.nextLine().toCharArray();
		int n = line.length;
		int[] s = new int[n];
		String ans = "";
		for(int i = 0;i < n;i++) s[i] = line[i] - '0';
		
		// 探索
		long sum = s[0];
		int op = 0;
		for(int i = 0;i < (1 << n - 1);i++) {
			sum = s[0];
			op = i;
			for(int j = 0;j < n - 1;j++) {
				if((i >> j & 1) != 1) {
					sum -= s[j + 1];
				}
				else {
					sum += s[j + 1];
				}
			}

			if(sum == 7) {
				break;
			}
		}

		// 結果の出力
		for(int i = 0;i < n;i++) {
			ans += s[i];
			if((op >> i & 1) == 1 && i != n - 1) {
				ans += "+";
			}
			else if(i != n - 1){
				ans += "-";
			}
		}
		
		ans += "=7";
		System.out.println(ans);		
    }
}

Measured memory_bytes: 23764
#include<stdio.h>
int main()
{
    int W,H,x,y,r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if( (x+r)<=W && (y+r)<=H && x>=r && y>=r){
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}




Measured memory_bytes: 2100
// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n){
    string s1 = "24579";
    string s2 = "0168";
    if(s1.find(n % 10 + '0') != string::npos)
        cout << "hon" << endl;
    else if(s2.find(n % 10 + '0') != string::npos)
        cout << "pon" << endl;
    else
        cout << "bon" << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3692
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;


int main() {
	
	
	long long N,K, temp,t;
	cin >> N >> K;

	t = N;
	int ttt = 0;

	for (int i = 0; true; i++)
	{
		t /= K;
		ttt += 1;
		if (t == 0)
			break;
	}
	
	
	
	cout << ttt << endl;

	return 0;
}




Measured memory_bytes: 384
#include <stdio.h>
int main()
{
    int n, a[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    scanf("%d", &n);
    printf("%d", a[n-1]);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 200001
#define mod 1000000007
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
ll n, c[MAX_N];

ll modpow(ll x, ll n) {
    if (n == 0) return 1;
    return modpow(x * x % mod, n / 2) * (n & 1 ? x : 1) % mod;
}

ll modinv(ll a) {
    return modpow(a, mod - 2);
}

// assert m is prime
inline ll  inverse(ll  a, ll  m) {
    ll  b = m, x = 1, y = 0;
    // extgcd(a, m, x, y)
    while (b) {
        ll  t = a / b;
        swap(a -= t * b, b);
        swap(x -= t * y, y);
    }
    return (x % m + m) % m;
}


vector<ll> fact, inv_fact;
void init_fact(ll n) {
    fact.resize(n);
    fact[0] = 1;
    for (ll i = 1; i < n; i++) {
        fact[i] = i * fact[i - 1] % mod;
    }
    inv_fact.resize(n);
    inv_fact[n - 1] = inverse(fact[n - 1], mod);
    for (ll i = n - 2; i >= 0; i--) {
        inv_fact[i] = (i + 1) * inv_fact[i + 1] % mod;
    }
}

ll nPr(ll n, ll r) {
    if (n < r || n < 0 || r < 0) return 0;
    return fact[n] * inv_fact[n - r] % mod;
}

ll nCr(ll n, ll r) {
    if (n < r || n < 0 || r < 0) return 0;
    return fact[n] * inv_fact[r] % mod * inv_fact[n - r] % mod;
}

ll nHr(ll n, ll r) {
    if (n == 0 && r == 0) return 1;
    return nCr(n + r - 1, r);
}


ll mod_pow(ll x, ll n){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

signed main(){
    cin >> n;
    REP(i, n) cin >> c[i];
    sort(c, c+n);
    ll ret = 0;
    REP(i, n){
        ll add = (n - i + 1) * c[i] % mod;
        add *= modpow(2, 2*n-2);
        add %= mod;
        ret += add;
        ret %= mod;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

int main() {
  int N[200005] = {0};

  int n;
  cin >> n;

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

  int find = 1;
  int count = 0;
  for (int i = 0; i < n; ++i) {
    if (N[i] == find) {
      count++;
      find++;
    }
  }

  if (find == 1 && count == 0) {
    cout << -1 << endl;
  } else {
    cout << n-count << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

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

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int n;cin>>n;
    VL l(n);

    REP(i,n){
        cin>>l[i];
    }


    LL result = 0;
    FOR(i,0,n){
        FOR(j,i+1,n){
            FOR(k,j+1,n){
                if(l[i] == l[j] || l[j]==l[k] || l[k]==l[i]){
                    continue;
                }
                VL t={l[i],l[j],l[k]};
                SORT_DESC(t);
                if(t[0] < t[1]+t[2]){
                    result++;
                }
            }
        }
    }
    cout<<result<<endl;
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long A,B;
    
    cin >> A >> B;
    if(A<B)swap(A,B);
    
    if((A+B)%2==1){
        cout <<"IMPOSSIBLE"<<endl;
        return 0;
    }
    
    cout << (A+B)/2<< endl;
    
    
}


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

using namespace std;

#define ll long long

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    ll arr[n];
    for(int i = 0;i<n;i++){
        cin>>arr[i];
    }
    ll ans = 0;
    ll vec[n+1] = {0};
    for(int i = 0;i<n;i++){
        vec[arr[i]] ++;
    }
    for(int i = 0;i<=n;i++){
        ans += (vec[i]*(vec[i]-1))/2;
    }
    for(int i = 0;i<n;i++){
        cout<<ans - vec[arr[i]] + 1<<endl;
    }
    return 0;
}


Measured memory_bytes: 6144
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i=0;i<(n); ++i)
#define log(i,n) log(n)/log(i);
using namespace std;
typedef long long ll;


int main()
{
	ll n,x=0,sum=0;
	cin >> n;
	vector<ll>a(n),dif;
	rep(i, n)cin >> a[i];
	sum = accumulate(a.begin(),a.end(),0LL);
	for (ll i = 0; i < n-1;i++) {
		x += a[i];
		dif.push_back(abs(2*x - sum));
		//cout << accumulate(a.begin(), a.begin() + i, 0) << "  " << accumulate(a.begin() + i, a.end(), 0) << endl;
	}
	cout << *min_element(dif.begin(), dif.end()) << endl;
}



Measured memory_bytes: 3956
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <iostream>

using int64 = long long;
int main(void) {
  int n;
  while (scanf("%d", &n) == 1) {
    struct E {
      int64 a;
      int64 b;
      auto key_a() const {
        return std::make_pair(a + b, a);
      }
      auto key_b() const {
        return std::make_pair(b + a, b);
      }
    };
    std::vector<E> v(n);
    for (auto &e : v) {
      scanf("%lld%lld", &e.a, &e.b);
    }
    std::vector<int> A(n);
    std::vector<int> B(n);
    std::vector<bool> was(n, false);
    for (int i = 0; i < n; i++) {
      A[i] = i;
      B[i] = i;
    }
    std::sort(A.begin(), A.end(), [&](int i, int j) { return v[i].key_a() > v[j].key_a(); });
    std::sort(B.begin(), B.end(), [&](int i, int j) { return v[i].key_b() > v[j].key_b(); });
    int64 res = 0;
    int ai = 0;
    int bi = 0;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0) {
        while (was[A[ai]]) {
          ai++;
        }
        was[A[ai]] = true;
        res += v[A[ai]].a;
      } else {
        while (was[B[bi]]) {
          bi++;
        }
        was[B[bi]] = true;
        res -= v[B[bi]].b;
      }
    }
    printf("%lld\n", res);
  }

  return 0;
}


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

void solve() {
  int r,c;
  cin >> r >> c;
  char a[r][c];
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < c + 2; i++) {
    cout << "#";
  }
  cout << "\n";
  for (int i = 0; i < r; i++) {
    cout << "#";
    for (int j = 0; j < c; j++) {
      cout << a[i][j];
    }
    cout<< "#" << '\n';
  }
  for (int i = 0; i < c + 2; i++) {
    cout << "#";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
 }


Measured memory_bytes: 3580
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N = I()
A = sorted(LI())
B = sorted(LI())
C = sorted(LI())

BC = []
for b in B:
    idx = bisect.bisect_right(C, b)
    BC.append(len(B)-idx)

b_ac = [0]
for b in reversed(BC):
    b_ac.append(b+b_ac[-1])
b_ac.sort(reverse=True)
#  print(b_ac)
result = 0
for a in A:
    idx = bisect.bisect_right(B, a)
    result += b_ac[idx]
print(result)


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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> L(N);
    for (auto& l : L) {
        cin >> l;
    }
    sort(L.begin(), L.end());
    long long ans = 0;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N - 1; j++) {
            int lb = lower_bound(L.begin(), L.end(), L.at(i) + L.at(j)) - L.begin();
            ans += max(lb - j - 1, 0);
        }
    }
    cout << ans << endl;
    return 0;
}


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

void bubbleSort(int a[], int N){
  bool flg =1;
  int count=0;
  while(flg){
    flg =0;
    for(int j=N-1;j>0;j--){
      if(a[j]<a[j-1]) {
        swap(a[j],a[j-1]);
        count++;
        flg=1;
      }

    }
  }

  for(int k=0;k<N;k++){
      if(k==N-1) cout<<a[k]<<endl;
      else cout <<a[k]<<" ";
    }
    cout<<count<<endl;

}

int main() {
  int N;
  cin>>N;
  int a[N];
  for (int j = 0; j < N; j++) cin>>a[j];

  bubbleSort(a,N);
  //for(int k=0;k<N;k++){
    //  if(k==N-1) cout<<a[k]<<endl;
     // else cout <<a[k]<<" ";
    //}

}



Measured memory_bytes: 3116
list=[input()for i in range(4)]

list1=list[0].split()
list2=list[1].split()
list3=list[2].split()
list1=[int(i) for i in list1]
list2=[int(i) for i in list2]
list3=[int(i) for i in list3]
c=int(list[3])
b=[input()for i in range(c)]
b=[int(i) for i in b]

for i in b:
    for x in range(3):
        if i==list1[x]:
            list1[x]=0
        elif i==list2[x]:
            list2[x]=0
        elif i==list3[x]:
            list3[x]=0

list4=[list1[0],list2[0],list3[0]]
list5=[list1[1],list2[1],list3[1]]
list6=[list1[2],list2[2],list3[2]]
list7=[list1[0],list2[1],list3[2]]
list8=[list1[2],list2[1],list3[0]]
if sum(list1)==0 or sum(list2)==0 or sum(list3)==0 or sum(list4)==0 or sum(list5)==0 or sum(list6)==0 or sum(list7)==0 or sum(list8)==0:
    an="Yes"
else:
    an="No"
print(an)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> p(n), q(n), t(n);
  rep(i, 0, n) cin >> p[i];
  rep(i, 0, n) cin >> q[i];
  rep(i, 0, n) t[i] = i+1;
  int p1 = -1, q1 = -1;
  for(int i = 0; p1 == -1|| q1 == -1; i++) {
    if(p == t) {
      p1 = i;
    } if(q == t) {
      q1 = i;
    }
    next_permutation(t.begin(), t.end());
  }
  cout << abs(p1-q1);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int a,b,c,x,y,ans=1e9;
    cin >> a >> b >> c >> x >> y;
    rep(i,max(2*x,2*y)+1){
        int d=0,e=0;
        if(x-i/2>0) d = a*(x-i/2);
        if(y-i/2>0) e = b*(y-i/2);
        ans = min(ans,c*i+d+e);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

bool pallan(string &S)
{
    string temp = S;
    
    reverse(temp.begin(),temp.end());
    if(temp==S) return true;
    return false;
    
    
}

void solve()
{   
    ll n;cin>>n;
    ll a[n+1],mp[n+10]={0};
    for(ll i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]]++;
    }
    ll s=0;
    for(ll i=1;i<=n;i++){
        s += (mp[i]*(mp[i]-1))/2;
    }
    
    for(ll i=0;i<n;i++){
        s -= (mp[a[i]]*(mp[a[i]]-1))/2;
        mp[a[i]]--;
        s += (mp[a[i]]*(mp[a[i]]-1))/2;
        cout<<s<<endl;
        s -= (mp[a[i]]*(mp[a[i]]-1))/2;
        mp[a[i]]++;
        s += (mp[a[i]]*(mp[a[i]]-1))/2;
    }
    
    
}

int main() {
    
    // ll t;cin>>t;while(t--)
    {
        solve();
    }
    
	return 0;
}

Measured memory_bytes: 5760
// includes, macros {{{
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <list>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
using namespace std;

#define eps (1e-10)
#define equals(a, b) (fabs((a)-(b)) < eps)

#define rep(i, s, e)    for (int i = (s); i < (int)(e); i++)
//#define pb(e) push_back(e)
//#define mp(a, b) make_pair(a, b)

// for debug
#define kita            cout << "kita\n"
#define print2(i, n)    cout << (i) << ": " << (n) << endl
#define print3(i, j, n)     cout << "(" << (i) << ", " << (j) << ") : " << (n) << endl
#define print4(i, j, n, m)  cout << "(" << (i) << ", " << (j) << ") : " << (n) << ", " << (m) << endl
#define print_mat(mat, h, w) for(int i=0;i<(h);i++){for(int j=0;j<(w);j++){cout << mat[i][j] << " ";}cout << endl;}
 
typedef long long ll;
typedef unsigned long long ull; // }}}

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

    cin >> n;

    for(int i=0;i<n;i++){
        int aa;
        cin >> aa;
        a.push_back(aa);
    }

    for(int i=0;i<n;i++){
        if(i%2 == 0){
            b.push_back(a[i]);
        }else{
            b.push_front(a[i]);
        }
    }


    if(n%2 != 0){
        reverse(b.begin(), b.end());
    }

    // bool flag = true;
    for(auto bb : b){
        // if(!flag){
        //     cout << " ";
        // }
        // flag = false;
        // cout << bb;
        cout << bb << " ";
    }

    // cout << endl;

    return 0;
}


Measured memory_bytes: 9204
import sys
from collections import deque

H, W = map(int, sys.stdin.readline().split())
cy, cx = map(int, sys.stdin.readline().split())
gy, gx = map(int, sys.stdin.readline().split())

cy -= 1
cx -= 1
gy -= 1
gx -= 1

grid = []
for _ in range(H):
    grid.append(sys.stdin.readline().strip())

q = deque()
# x, y, 累積移動距離, ブロック通過数, ワープ利用数
q.append((cx, cy, 0))
# visited = {}
visited = [[float("inf") for _ in range(W)] for _ in range(H)]
# visited[(cx, cy)] = 0
visited[cy][cx] = 0
ans = float("inf")
# 01 BFS
while q:
    x, y, c = q.popleft()
    # if (x, y) in visited and visited[(x, y)] < c:
    if visited[y][x] < c:
        # print("here1")
        continue
    # print(x, y, c, d, e)
    for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        nx = x + dx
        ny = y + dy
        if 0 <= nx < W and 0 <= ny < H and grid[ny][nx] != "#":
            # if (nx, ny) in visited and visited[(nx, ny)] < c + 1:
            if visited[ny][nx] <= c:
                # print("here2")
                continue
            # visited[(nx, ny)] = c
            visited[ny][nx] = c
            if nx == gx and ny == gy:
                continue
            q.appendleft((nx, ny, c))
    for dx in range(-2, 3):
        for dy in range(-2, 3):
            if abs(dx) == 1 and dy == 0 or abs(dy) == 1 and dx == 0:
                continue
            nx = x + dx
            ny = y + dy
            # print("warp", dx, dy)
            if 0 <= nx < W and 0 <= ny < H and grid[ny][nx] != "#":
                # print("warp append")
                # if (nx, ny) in visited and visited[(nx, ny)] < c + 1:
                if visited[ny][nx] < c + 1:
                    # print("here3")
                    continue
                # visited[(nx, ny)] = c + 1
                visited[ny][nx] = c + 1
                if nx == gx and ny == gy:
                    continue
                q.append((nx, ny, c+1))
# print(visited)
if visited[gy][gx] == float("inf"):
    print(-1)
else:
    print(visited[gy][gx])

Measured memory_bytes: 222784
# https://atcoder.jp/contests/abc126/tasks/abc126_c
N, K = list(map(int, input().split()))

probs = []
keisuu = 1 / N
for dice in range(1, N + 1):
    score = dice
    cnt = 0
    while score < K:
        score *= 2
        cnt += 1
    probs.append(keisuu * (1 / 2)**cnt)


print(sum(probs))


Measured memory_bytes: 6296
using System;
using System.Linq;

class E2
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int n = h[0], k = h[1];

		var dp = new MInt[k + 1];
		for (int i = k; i > 0; i--)
		{
			dp[i] = ((MInt)(k / i)).Pow(n);
			for (int j = 2 * i; j <= k; j += i)
				dp[i] -= dp[j];
		}
		Console.WriteLine(dp.Select((x, i) => x * i).Aggregate((x, y) => x + y));
	}
}

struct MInt
{
	const int M = 1000000007;
	public long V;
	public MInt(long v) { V = (v %= M) < 0 ? v + M : v; }

	public static implicit operator MInt(long v) => new MInt(v);
	public static MInt operator +(MInt x, MInt y) => x.V + y.V;
	public static MInt operator -(MInt x, MInt y) => x.V - y.V;
	public static MInt operator *(MInt x, MInt y) => x.V * y.V;

	public MInt Pow(int i) => MPow(V, i);
	public override string ToString() => $"{V}";

	static long MPow(long b, int i)
	{
		for (var r = 1L; ; b = b * b % M)
		{
			if (i % 2 > 0) r = r * b % M;
			if ((i /= 2) < 1) return r;
		}
	}
}


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

if n==k:
    ans = 0
    for i in li:
        ans += i*0.5+0.5
    print(ans)
    exit()

K = sum(li[:k])
ans = K
t = 0
for i in range(n-k):
    K += li[i+k] - li[i]
    if K > ans:
        ans = K
        t = i
ans = 0
for i in range(k):
    ans += li[t+i+1]*0.5 + 0.5
print(ans)

Measured memory_bytes: 98908
#include<iostream>

using namespace std;

const int inf = 1e8;

int d[201][201][2];
int E,V;

int main(){
  while(cin>> E >> V,E+V){
    for(int i = 0 ;  i < V ; i ++)
      for(int j = 0 ; j < V ; j ++){
	d[i][j][0] = inf;
	d[i][j][1] = inf;
      }
    int s,t,c,ti;
    for(int i = 0 ; i < E ; i ++){
      cin>>s>>t>>c>>ti;
      s--; t--;
      d[s][t][0] = c;
      d[s][t][1] = ti;
    
      d[t][s][0] = c;
      d[t][s][1] = ti;
    }
    
    for(int k=0; k < V; k++){
        for(int i=0; i < V; i++){
            for(int j=0; j < V; j++){
                d[i][j][1] = min(d[i][j][1], d[i][k][1] + d[k][j][1]);
                d[i][j][0] = min(d[i][j][0], d[i][k][0] + d[k][j][0]);
            }
        }
    }

    int num;
    cin>>num;
    for(int i = 0 ; i < num ; i ++){
      int start , terminus , version;
      cin>>start >> terminus >> version;
      start -- ; terminus --;
      cout<<(version?d[start][terminus][1]:d[start][terminus][0]) <<endl;
    }
  }
}

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

/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

using namespace std;

typedef long long ll;

ll k;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> k;
    ll p = 0;
    for(int i = 1; i <= 2000000; i++)
    {
        p = (p * 10 % k + 7) % k;
        if(p == 0)
        {
            cout << i << "\n";
            return 0;
        }
    }
    cout << "-1\n";
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

int N, M, P, A[100];
int sum;

int main(void) {
  while(cin >> N >> M >> P, N || M || P) {
    REP(i, 0, N) cin >> A[i];

    sum = 0;
    REP(i, 0, N) sum += A[i];

    if(A[M - 1] > 0) {
      int ans = (double) 100 * sum * (100 - P) / (100 * A[M - 1]);
      cout << ans << endl;
    } else {
      cout << 0 << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3088
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long LL;
int main()
{
	LL K,A,B;
	scanf("%lld %lld %lld",&K,&A,&B);
	LL sum=A;
	if(sum>=K)
		printf("1\n");
	else
	if(sum<K && B>=A)
		printf("-1\n");
	else
	{
		LL gg;
		LL times=(K-sum)/(A-B);
		if((K-sum)%(A-B)!=0)
			times++;
		gg=times*2+1;
		printf("%lld\n",gg);
	}
	return 0;
 } 

Measured memory_bytes: 128
import java.util.*;

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


        String s = in.next();
        
        int f = -1, l = -1;
        
        for (int i = 0; i < s.length() - 1; i++) {
            if(s.charAt(i) == s.charAt(i + 1)){
                f = i + 1;
                l = i + 2;
                break;
            }
            else if(i < s.length() - 2){
                if(s.charAt(i) == s.charAt(i + 2)){
                    f = i + 1;
                    l = i + 3;
                    break;
                }
            }
        }
        System.out.println(f + " " + l);
    }
}


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

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

void solve() {
    int N, M;
    cin >> N >> M;

    vector<int> p(N);
    rep(i, N) {
        cin >> p[i];
        p[i]--;
    }
    UnionFind uf = UnionFind(N);
    rep(i,M) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        uf.unite(x,y);
    }

    map<int, set<int>> mp;
    rep(i,N) mp[uf.find(i)].insert(p[i]);

    ll ans = 0;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        set<int> val = itr->second;
        set<int> cand;
        for (auto it = val.begin(); it != val.end(); it++) {
            cand.insert(p[*it]);
        }

        vector<int> result;
        set_intersection(begin(val), end(val),
                  begin(cand), end(cand),
                  inserter(result, end(result)));

        ans += result.size();
    }

    cout << ans << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 15740
while True:
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=="?":
        break
    if op=="+":
        print(a+b)
    if op=="-":
        print(a-b)
    if op=="*":
        print(a*b)
    if op=="/":
        print(a//b)


Measured memory_bytes: 5596
#include<stdio.h>
int main(){
int W,H,x,y,r;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

if(((r<=x)&&(x<=W-r))&&((r<=y)&&(y<=H-r))){
printf("Yes\n");
}else{
printf("No\n");
}

return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define ll long long
#define oo 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	int n;
	cin >> n;
	string s;
	cin >> s;
	if(s.size() <= n) cout << s;
	else{
		for(int i=0; i<n; i++){
			cout << s[i];
		}
		cout << "...";
	}

	return 0;
}


Measured memory_bytes: 3632
import kotlin.math.abs

fun main() {
    val (X, N) = readLine()?.split(" ")?.map { Integer.parseInt(it) } ?: return
    if (N == 0) {
        println(X)
        return
    }
    val p = readLine()?.split(" ")?.map { Integer.parseInt(it) }?.sorted() ?: return
    var frag: Boolean
    val num = intArrayOf(Integer.MAX_VALUE, 0)
    for (i in 0..p[p.size - 1]+1) {
        frag = true
        for (j in p) {
            if (j == i) {
                frag = false
                break
            }

        }
        if (frag) {
            if (abs(X - i) < num[0]) {
                num[0] = abs(X - i)
                num[1] = i
            }
        }
    }
    println(num[1])
}

Measured memory_bytes: 38944
<?php
fscanf(STDIN, "%d %d",$n,$k);
for ($i=0; $i < $n; $i++)
	fscanf(STDIN,"%d %d",$p[$i][0],$p[$i][1]);

foreach ((array) $p as $key => $value)
    $sort[$key] = $value[0];
array_multisort($sort, SORT_ASC, $p);

for ($i=0; $i < $n; $i++)
{ 
	$k-=$p[$i][1];
	if($k<=0)
	{
		$result=$p[$i][0];
		break;
	}
}

printf("%d",$result);

Measured memory_bytes: 63348
st = str(input())
tmp = st.split(" ")
N = int(tmp[0])
K = int(tmp[1])
y = str(input())
if N <= K:
    print(1)
else:
    x = 0
    if (N - K) % (K - 1) != 0:
        x = 1
    print(((N - K) // (K - 1) + x + 1))


Measured memory_bytes: 4724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
#define MOD 1000000007
#define INF 1000000

/*
受験の時にやった重複順列とか言うやつ
矢印を入れ替える問題

X-Kがマイナスになる場合を考慮してなかった・・・・・

*/

ll X,Y,K;

ll fac[1000100];

void fac_init()
{
  fac[0]=1;
  fac[1]=1;
  for (int i=2;i<=1000100;i++)
  {
     fac[i] = fac[i-1]*i % MOD;
  }
}

ll fast(ll a,ll n)
{
  ll ans = 1;
  while (n>0)
  {
    if (n & 1)
      ans *= a; 
    ans %= MOD;
    a *= a;
    a %= MOD;
    n /= 2;
  }
  return (ans);
}

int main()
{
  cin>>X>>Y;
  if ((X+Y) % 3 != 0)
  {
    cout<<0<<endl;
    return (0);
  }
  
  K = (X+Y)/3;
  ll n = X-K;
  ll m = K-n;
  
  if (n<0 || m<0)
  {
    cout<<0<<endl;
    return (0);
  }
  //cout<<K<<" "<<n<<" "<<m<<endl;
  
  fac_init();
  
  //for (int i=2;i<=10;i++)
    //cout<<"fac["<<i<<"]="<<fac[i]<<endl;
  
  ll top = fac[n+m] % MOD;
  ll bot = fac[n]*fac[m] % MOD;
  
  ll ans = top * fast(bot, MOD-2) % MOD;
  cout<<ans<<endl;
}

Measured memory_bytes: 8064
import sys

s = sys.stdin.readline().strip()
n = len(s)

def solve(s, n):
    for i in range(0, n - 1):
        if s[i] == s[i + 1]:
            print i+1, i+2
            return

    for i in range(0, n - 2):
        if s[i] == s[i + 2]:
            print i+1, i+3
            return

    print -1, -1

solve(s, n)


Measured memory_bytes: 5892
#include <iostream>

int a[4], b[4], count[5], countmax= 0, countmin = 10;
int main()
{
	for (int i = 1; i < 4; i++)
	{
		std::cin >> a[i] >> b[i];
		for(int j = 1; j < 5; j++)
		{
		

			if(a[i] == j)
			{
				count[j]++;
			}
			if(b[i] == j)
			{
				count[j]++;
			}
		}
		
	}
	for(int i = 1; i < 5; i++)
	{
		if(countmax < count[i])
		{
			countmax = count[i];
		}

		if(count[i] < countmin)
		{
			countmin = count[i];
		}
	}

	//std::cout << countmax << " " << countmin;

	if(countmax > 2)
	{
		std::cout << "NO";
	}else if(countmin == 0)
	{
		std::cout << "NO";
	}else
	{
		std::cout << "YES";
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
typedef long long ll;
struct line{
    ll m,n;
    line(ll _m = 0, ll _n = 0){
        m = _m,n = _n;
    }
}A[maxn];
ll get_y(const line &a,const int &x){
    return a.m*x+a.n;
}
bool ok(const line &a,const line &b,const line &c){
    return (a.m-b.m)*(c.n-a.n)<=(a.m-c.m)*(b.n-a.n);
}
int l,r;
void add(const line f){
    while(l < r && ok(A[r-1],A[r],f)){
        r--;
    }
    r++;
    A[r] = f;
}
line query(const int x){
    while(l < r && get_y(A[l],x)>get_y(A[l+1],x))
        l++;
    return A[l];
}
ll sq(int x){
    return (ll)x*x;
}
int h[maxn];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen(".in","r",stdin);
    int N;
    ll C;
    cin >> N >> C;
    for (int i = 1; i <= N;i++){
        cin >> h[i];
    }
    A[1] = line(-2*h[1],sq(h[1]));
    l = r = 1;
    ll mx = 0;
    for (int i = 2; i <= N;i++){
        ll q = get_y(query(h[i]),h[i]);
        mx = q+C+sq(h[i]);
        add(line(-2*h[i],mx+sq(h[i])));
    }
    cout << mx;
    return 0;
}


Measured memory_bytes: 4352
import math
import numpy as np
import queue
from collections import deque
import heapq
mod = 10**9+7
ans = 1
iw0 = 0

def twoxxn(t,mod):
    ni = t
    an = 1
    n2 = 2
    while ni > 0:
        if ni%2 == 1:
            an = (an*n2)%mod
        n2 = (n2**2)%mod
        ni >>= 1
    return an

n = int(input())
d = dict()
for i in range(n):
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        iw0 += 1
        continue
    if a == 0:
        b = 1
        g = 1
    elif b == 0:
        a = 1
        g = 1
    else:
        g = math.gcd(abs(a),abs(b))
    if a < 0 :
        a = -a
        b = -b
    p1 = a//g, b//g
    if p1 in d:
        d[p1] += 1
    else:
        d[p1] = 1
done = []
for (i0,i1), din in d.items():
    if d.get((-i1,i0),1) == 0 or d.get((i1,-i0),1) == 0:
        continue
    w = d.get((i1,-i0),0) + d.get((-i1,i0),0)
    aaa = (twoxxn(w,mod)+twoxxn(din,mod)-1)%mod
    ans = (ans*aaa)%mod
    d[(i0,i1)] = 0

if len(d.keys()) == 0:
    print(iw0)
    exit()

ans = (iw0+ans+mod-1)%mod
print(ans)


Measured memory_bytes: 64128
#include <stdio.h>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define FOR(i,m,n) for(i=m;i<n;i++)

int main(void)
{
	int a,b,c,i;
	scanf("%d %d %d",&a,&b,&c);
	if(a<c&&c<b){
		printf("Yes");
	}else if(b<c&&c<a){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			long x = scanner.nextLong();
			long remander = x % 11;
			System.out.println(x / 11L * 2L + ((remander == 0) ? 0 : (remander > 6) ? 2 : 1));
		}
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define CFS           \
    cin.tie(nullptr); \
    ios::sync_with_stdio(false);
#define CST(x) cout << fixed << setprecision(x);
using namespace std;
const int IINF = 1 << 30;
const long LINF = 1LL << 60;
const int MOD = (int)1e9 + 7;
// const int MOD = 998244353;

int main()
{
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes" << "\n";
    }
    else {
        cout << "No" << "\n";
    }
}

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

int main() {
	int A=0;
	int B=0;
	int C=0;

std::cin >>A>>B>>C;

if ((A==5&&B==5&C==7)||(A==5&&B==7&C==5)||(A==7&&B==5&C==5))
{
	std::cout << "YES" << std::endl;
	return 0;
}

std::cout << "NO" << std::endl;


	return 0;
}

Measured memory_bytes: 3152
#include<iostream>
#include<algorithm>
using lint=long long;
using namespace std;

int main()
{
	string S;
	lint K;
	
	cin >> S >> K;
	
	for(lint i=0;i<K;i++)
	{
		if(S[i]!='1' || i==K-1)
		{
			cout << S[i] << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256