akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, K;
    int64_t count;
    cin >> N >> K;
    vector<int64_t> H(N);
    for(int i=0;i<N;i++){
        cin >> H.at(i);
    }
    
    if (K>=N){
        count=0;
    }else{
        sort(H.begin(),H.end(),greater<int64_t>());
        for(int i=0;i<K;i++){
            H.at(i) = 0;
        }
        count = accumulate(H.begin(), H.end(), int64_t(0));
    }

    cout << count << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

int main() {
    int n, a[100] = {}; double m = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        m += 1. / a[i];
    }
    printf("%.6f\n", 1 / m);
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;
typedef complex<int> point;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>

#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

#define watch(x) cerr << (#x) << " = " << (x)    << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}



void smain();

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

#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

string must = "keyence";


void out(bool ok) {
    cout << (ok ? "YES" : "NO");
    exit(0);
}

void smain() {

    string s;
    cin >> s;
    int n = s.size();
    if (s == must) out(1);
    for (int  l = 0; l < n; ++l) {
        for (int r = l; r < n; ++r) {
            string get = s.substr(0, l);
            string b = s.substr(r + 1, n - r - 1);
            get += b;
//            watch(get);
//            watch(b);
            if (get == must) out(1);
        }
    }
    out(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const int nmax = 8;
bool graph[nmax][nmax];
const int INF = 1e9;
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

int dfs(int v, ll N, bool visited[nmax])
{
    bool all_visited = true;

    for (int i = 0; i < N; i++)
    {
        if (!visited[i])
        {
            all_visited = false;
        }
    }

    if (all_visited)
    {
        return 1;
    }
    int ret = 0;
    for (size_t i = 0; i < N; i++)
    {
        if (!graph[v][i])
        {
            continue;
        }
        if (visited[i])
        {
            continue;
        }

        visited[i] = true;
        ret += dfs(i, N, visited);
        visited[i] = false;
    }

    return ret;
}

void solve(long long A, long long B, long long K)
{
    vector<ll> cd;

    for (int i = 1; i <= max(A, B); i++)
    {
        if (A % i == 0 && B % i == 0)
        {
            cd.push_back(i);
        }
    }
    RSORT(cd);

    cout << cd[K - 1] << endl;
}

int main()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long K;
    scanf("%lld", &K);
    solve(A, B, K);
    return 0;
}


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



int main() {
  int N; cin >> N;
  string S; cin >> S;
  int c = 0;
  rep(i,N-2){
    if(S.substr(i,3) == "ABC")c++;
  }
  cout << c << endl;

	return 0;
}



Measured memory_bytes: 3600
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a[5],b[5];
    for(int i=0;i<5;i++) {
        cin>>a[i];
        b[i]=a[i];
        while(b[i]>10){
            b[i]%=10;
        }
        if(b[i]!=0) a[i]=a[i]-b[i]+10;
    }
    int mib=10,j=0,ans=0;
    for(int i=0;i<5;i++){
        if(b[i]<mib&&b[i]!=0) {
            mib=b[i];
            j=i;
        }
    }
    for(int i=0;i<5;i++){
        ans+=a[i];
    }
    if(b[j]<10) ans-=10-b[j];
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
using namespace std;
 
int main()
{
    map<char,int>maps;
    char s[30];
    int t=1;
    scanf("%s",s);
    for(int i=0; i<strlen(s); i++)
    {
        maps[s[i]]++;
        if(maps[s[i]]==2)
        {
            t=0;
            break;
        }
    }
    if(t)
        printf("yes\n");
    else
        printf("no\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

i64 largest_rectangle(vi hist) {
    hist.push_back(0);
    using ii = pair<i64, int>;
    stack<ii> st;
    i64 ret = 0;
    for (int i = 0; i < hist.size(); i++) {
        if (st.empty() || st.top().first < hist[i]) {
            st.push(ii(hist[i], i));
        } else {
            int s;
            while (st.size() && st.top().first >= hist[i]) {
                ret = max(ret, st.top().first * (i - st.top().second));
                s = st.top().second;
                st.pop();
            }
            st.push(ii(hist[i], s));
        }
    }
    
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(10);
    int h, w;
    cin >> h >> w;
    vvi b(h, vi(w));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int c;
            cin >> c;
            if (c == 0) {
                if (i == 0) {
                    b[i][j] = 1;
                } else {
                    b[i][j] = b[i - 1][j] + 1;
                }
            } else {
                b[i][j] = 0;
            }
        }
    }

    i64 ret = 0;
    for (int i = 0; i < h; i++) {
        ret = max(ret, largest_rectangle(b[i]));
    }
    cout << ret << endl;
}


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

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    if(A == 0){
        cout << 0;
        return 0;
    }
    if(A == 0 && B == 0){
        cout << 0;
        return 0;
    }
    ll c = A + B;
    ll d = N / c;
    ll e = N % c;
    if(e >= A) e = A;
    ll ans = A * d + e;
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[100010];
int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<=n;i++){
		cin>>a[i];
	}
	ll ans=0;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		ans+=min(x,a[i]);
		if(x>a[i]){
			ans+=min(a[i+1],x-a[i]);
			a[i+1]=max(ll(0),a[i+1]-(x-a[i]));
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 1024
;; -*- coding:utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 1))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload :cl-debug-print))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS

(defmacro nlet (name args &body body)
  `(labels ((,name ,(mapcar #'car args) ,@body))
     (,name ,@(mapcar #'cadr args))))


(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

;; Hauptteil

;; f(n,x) = f(n-1, x-1) when 1 <= x <= s(n-1)+1
;;          F(n-1)+1 when x = s(n-1)+2
;;          F(n-1)+1+f(n-1, x-s(n-1)-2) when s(n-1)+3 <= x <= 2s(n-1)+2
;; 	    F(n) when x = 2s(n-1)+3

(deftype uint nil `(integer 0 ,(expt 10 9)))

(defun solve (sizes patty-nums n x)
  (nlet recurse ((n n) (x x))
    (if (zerop x)
        0
        (if (zerop n)
            1
            (let ((sn-1 (aref sizes (- n 1))))
              (cond ((<= x (+ sn-1 1))
                     (recurse (- n 1) (- x 1)))
                    ((= x (+ sn-1 2))
                     (+ 1 (aref patty-nums (- n 1))))
                    ((<= (+ sn-1 3) x (+ sn-1 sn-1 2))
                     (+ 1 (aref patty-nums (- n 1))
                        (recurse (- n 1) (- x sn-1 2))))
                    ((= x (+ sn-1 sn-1 3))
                     (aref patty-nums n))
                    (t (error "Was?"))))))))

(defun main ()
  (let* ((n (read))
         (x (read))
         (size-table (make-array 51 :element-type 'fixnum))
         (patty-num-table (make-array 51 :element-type 'fixnum)))
    (loop for idx from 0 to 50
          for size = 1 then (+ size size 3)
          for patty-num = 1 then (+ patty-num patty-num 1)
          do (setf (aref size-table idx) size
                   (aref patty-num-table idx) patty-num))
    (println (solve size-table patty-num-table n x))))

#-swank(main)


Measured memory_bytes: 9056
#read in input
s = map((lambda x: ord(x) - 96), raw_input())
k = int(raw_input())


for i in range(len(s)):
  sv = s[i]
  if sv == 1 or (27 - sv) > k:
    continue
  s[i] = 1
  k = k - (27 - sv)

s[-1] = (((s[-1] + k) - 1) % 26) + 1

print "".join(map((lambda x: chr(x + 96)), s))

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


int main(){
    int a,b,t;
    cin >> a >> b >> t;
    int sum=0;
    int ti=a;
    while(ti<=(t+0.5)){
        sum+=b;
        ti+=a;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
int main()
{
    int N;
    std::cin >> N;
    int T, A;
    std::cin >> T >> A;
    std::vector<double> vs{};
    for (int i = 0; i < N; i++) {
        int H;
        std::cin >> H;
        double v = std::abs(T - H * 0.006 - A);
        vs.emplace_back(v);
    }

    int i = std::distance(vs.begin(), std::min_element(vs.begin(), vs.end()));
    std::cout << i + 1 << std::endl;
    return 0;
}

Measured memory_bytes: 256
fun main(arg: Array<String>) {
    val (A, B, C, D) = next().map { it - '0' }
    fun sign(a: Int) = if (a < 0) '-' else '+'
    for (bit in 0 until (1 shl 3)) {
        val b = if (((bit shr 0) and 1) == 1) -B else B
        val c = if (((bit shr 1) and 1) == 1) -C else C
        val d = if (((bit shr 2) and 1) == 1) -D else D
//System.err.println("$bit:  $A${sign(b)}$B${sign(c)}$C${sign(d)}$D=${A+b+c+d}")
        if (A + b + c + d == 7) {
            println("$A${sign(b)}$B${sign(c)}$C${sign(d)}$D=7")
            return
        }
    }
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
fun listOfLong() = listOfString().map(String::toLong)


Measured memory_bytes: 33820
#include <iostream>
#include <algorithm>

#define FOR(i,m,M) for(int i = m;i<M;i++)

using namespace std;

int main()
{
	string ans = "No";
	int size;
	cin >> size;
	string str;
	string s;
	cin >> str;

	if (size % 2 == 0)

	s = str.substr(0, size / 2);
	if (str == s + s)
		ans = "Yes";
	cout << ans;
}



Measured memory_bytes: 256
#include<iostream>
#include<set>
using namespace std;
int m,n;
int a[100005];
//int g[200005];
int fa[100005];
int sf(int x){return fa[x]==x?x:fa[x]=sf(fa[x]);}
int main(){
	while(cin>>n>>m){
		for(int i=1;i<=n;i++){
			fa[i]=i;
			cin>>a[i];
 		}
 		int u;int v;
 		for(int i=1;i<=m;i++){
 			cin>>u>>v;
 			fa[sf(a[u])]=sf(a[v]);
		}



//	for(int i=1;i<=2*m;i++){
	//		cout<<sf(fa[g[i]]);
	//	}
	//	cout<<endl;


		//这样子的话,输入的时候就预先初始化好了，然后再查询一下就好了
		//这样，能够联通的，有了共同爸爸的都放在一起了（虽然也不知道这些爸爸是谁。）
		//【一定是他们的sf相等！一定是sf相等！！！不然不行的不然到不了了   然后再查询
		int ans=0 ;
		for(int i=1;i<=n;i++){
		//	cout<<sf(g[i])<<" "<<sf(g[a[g[i]]])<<endl;
	//		if(sf(g[i])==sf(g[a[g[i]]]))
			if(sf(a[i])==sf(a[a[i]]))
			ans++;
		}

	//这里我就格外搞不懂了。。但是就是吧，需要注意一下，终极爸爸是sf。fa只是他的上级，没什么卵用的。
		cout<<ans<<endl;

	}
	return 0;
}

Measured memory_bytes: 1152
/*
I just got lost in thought. It was unfamiliar territory.
- Steven Wright
*/

#include <algorithm>
#include <bitset>
#include <complex>
#include <cstring>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iosfwd>
#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 <stdexcept>
#include <streambuf>
#include <string>
#include <vector>
//#include <boost/math/common_factor.hpp>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 1000000000;
const int MAX = 100005;
const int MAX1 = 2007;
const int MAX2 = 4007;
const int LEN = 21;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1234567891;
//g++ -std=c++11 your_file.cpp -o your_program

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ifstream in("");
    ofstream out("");
    ll n, m, mx = 0;
    cin >> n >> m;
    for (ll i = 1; i <= sqrt(m); ++i){
        ll tmp = -1;
        if (m % i == 0 && n * i <= m && mx < i) mx = i;
        if (m % i == 0) tmp = m / i;
        if (m % tmp == 0 && n * tmp <= m && mx < tmp) mx = tmp;
    }
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define M 1000000007
#define fors(i,n) for(int i=0;i<n;++i)
#define fore(i,a,b) for(int i=a;i<=b;++i)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vv vector<int>
#define endl "\n"
#define test(i) cout<<i<<endl
#define itrt int t; cin>>t; fors(i,t)
#define itr1 int t; cin>>t;
#define ff first
#define ss second
#define pb push_back
#define vmp make_pair
#define ppb pop_back
#define sorta(a,n) sort(arr,arr+n)
#define sortv(x) sort(x.begin(),x.end())
void file(){
    #ifdef LOCAL
    freopen("demo.in","r",stdin);
    freopen("demo.out","w",stdout);
    #endif
}
int main(){
    fastio;
    file();
    int a,b,m;
    cin>>a>>b>>m;
    vv va(a),vb(b);
    fors(i,a){
        cin>>va[i];
    }
    fors(i,b){
        cin>>vb[i];
    }
    int mina=*min_element(va.begin(),va.end());
    int minb=*min_element(vb.begin(),vb.end());
    int res=mina+minb;
    fors(i,m){
        int x,y,c;
        cin>>x>>y>>c;
        --x,--y;
        res=min(res,va[x]+vb[y]-c);
    }
    test(res);
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
  cin>>N;
  string s;
  cin>>s;

  for(int i=0;i<s.size();i++){
    int x=s.at(i)-'A';
    x=(x+N)%26;
    s.at(i)=x+'A';

    
  }
  cout<<s<<endl;
}

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

typedef long long int ll;

const double PI=3.14159265358979323846;

int main () {
    ll r; cin >> r;
    printf("%.6lf\n", (double)r * 2.0 * PI);
    return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=998244353,i2=(mod+1)/2;
int n,a[3010],S;
ll f[3010][3010];
ll po(ll a,ll b=mod-2){ll r=1;for(;b;b/=2,a=a*a%mod)if(b&1)r=r*a%mod;return r;}
int main(){
	scanf("%d%d",&n,&S);
	for(int i=1;i<=n;i++)scanf("%d",a+i);
	f[0][0]=po(2,n);
	for(int i=0;i<n;i++){
		for(int j=0;j<=S;j++){
			(f[i+1][j]+=f[i][j])%=mod;
			if(j+a[i+1]<=S)(f[i+1][j+a[i+1]]+=f[i][j]*i2)%=mod;
		}
	}
	printf("%lld\n",f[n][S]);
	return 0;
}

Measured memory_bytes: 74292
using System;
using System.Linq;
namespace AtCorder100_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int count = 0;
            for (int i = 0; i < N; i++)
            {
                while (A[i] % 2 == 0)
                {
                    A[i] = A[i] / 2;
                    count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}


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

using ll = int64_t;

signed main(){

  ll n;
  cin>>n;

  for(ll a=1;a<=3500;++a)for(ll b=1;b<=3500;++b){
    if(4*a*b-n*a-n*b==0)continue;
    ll c = n*a*b/(4*a*b-n*a-n*b);
    if(c<0)continue;
    if(4*a*b*c==n*(a*b+a*c+b*c)){
      cout<<a<<" "<<b<<" "<<c<<endl;
      return 0;
    }
  }

}

Measured memory_bytes: 256
N = int(input())
D = []
count = 0
for i in range(N):
  d = list(map(int, input().split()))
  if d[0] == d[1]:
    count += 1
  else:
    count = 0
  if count == 3:
    break

if count >= 3:
  print('Yes')
else:
  print('No')

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

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i < n + 1; i++)
    {
        if (i % 2 != 0)
            ans++;
    }
    double A = (double)ans / n;
    printf("%.10f\n", A);

    return 0;
}

Measured memory_bytes: 256
n = int(input())
f = []
for i in range(n):
  f += [[int(x) for x in input().split()]]
p = []
for i in range(n):
  p += [[int(x) for x in input().split()]]

res = -2100000000
for onechan in range(1, 2 ** 10):
  count = [0 for x in range(n)]
  b = 0
  d = onechan
  for k in range(10):
    if d % 2 == 1:
      for i in range(n):
        if f[i][k] == 1:
          count[i] += 1
    d //= 2

  for i in range(n):
    b += p[i][count[i]]
  res = max(b, res)

print(res)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=205;

int cnt[maxn],n,now,M;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&now);
		M=max(M,now);
		cnt[now]++;
	}
	
	for(int i=M;i>M-i;i--) 
	    if(cnt[i]<2){ puts("Impossible"); return 0;}
	
	if(!(M&1)&&cnt[M>>1]!=1){ puts("Impossible"); return 0;}
	if((M&1)&&cnt[M-(M>>1)]!=2){ puts("Impossible"); return 0;}
	
	puts("Possible");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

int main()
{
    int N, K;;
    std::cin >> N >> K;
    std::string S;
    std::cin >> S;

    int count = 0, RL = 0;
    for(int i=0; i<N-1; i++){
        if(S[i]=='L' && S[i+1]=='L') count++;
        if(S[i]=='R' && S[i+1]=='R') count++;
        if(S[i]=='R' && S[i+1]=='L') RL++;
    }
    count += std::min(RL, K)*2;
    K -= RL;
    if(K>=0 && S[0]=='R' && S[N-1]=='L') count--;

    if(count == N-1){std::cout << count << std::endl; return 0;}
    if(K>0 && S[0] == 'L'){count++; K--;}
    if(count == N-1){std::cout << count << std::endl; return 0;}
    if(K>0 && S[N-1] == 'R'){count++; K--;}

    std::cout << count << std::endl;
}

Measured memory_bytes: 512
INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
# from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

h, w = I()
g = []
for i in range(h):
    g.append(input())

rows = [[0] * (w + 10) for i in range(h + 10)]
cols = [[0] * (w + 10) for i in range(h + 10)]

ans = 0
for i in range(h):
    for j in range(w):
        rows[i][j] = (g[i][j] == '.')
        if j and g[i][j] == '.':
            rows[i][j] += rows[i][j - 1]
        cols[i][j] = (g[i][j] == '.')
        if i and g[i][j] == '.':
            cols[i][j] += cols[i - 1][j]
    for j in range(w - 1, -1, -1):
        if rows[i][j + 1] != 0 and rows[i][j]:
            rows[i][j] = rows[i][j + 1]

for i in range(h - 1, -1, -1):
    for j in range(w):
        if cols[i + 1][j] != 0 and cols[i][j]:
            cols[i][j] = cols[i + 1][j]
        ans = max(ans, rows[i][j] + cols[i][j] - 1)
print(ans)

Measured memory_bytes: 201092
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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

	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;

	vector<ll> A(X);
	rep(i, X) cin >> A[i];

	vector<ll> B(X);
	rep(i, Y) cin >> B[i];

	vector<ll> C(X);
	rep(i, Z) cin >> C[i];

	vector<ll> v;
	for(int i = 0; i < X; i++){
		for(int j = 0; j < Y; j++){
			v.push_back(A[i] + B[j]);
		}
	}

	sort(v.begin(), v.end(), greater<ll>());

	vector<ll> w;
	for(int i = 0; i < min(K, X * Y); i++){
		for(int j = 0; j < min(K, Z); j++){
			w.push_back(v[i] + C[j]);
		}
	}

	sort(w.begin(), w.end(), greater<ll>());
	rep(i, K) cout << w[i] << endl;
}


Measured memory_bytes: 42728
N,M=map(int,input().split())
sc=[list(map(int,input().split())) for m in range(M)]
for i in range(10**N):
    if len(str(i))==N and all(str(i)[s-1]==str(c) for s,c in sc):
        print(i)
        break
else:
    print(-1)

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

int main(){
	
	ll n; cin>>n;
	ll best = 1000000000000;
	for(ll i = 1; i*i <= n; i++){
		if(n%i == 0){
			ll dis = i-1 + ((n/i) -1 );
			best = min(dis,best);
		}
		//cout<<i<<"\n";
	}
	cout<<best<<"\n";
	
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

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

    string S;
    std::cin >> S;

    int n = count(S.begin(), S.end(), '+'),
        res = n - (4 - n);
    std::cout << res << std::endl;
}


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

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

  if (s[0] == s[1] && s[0] == s[2] && s[1] == s[2]) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

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

	string a, b, c;
	cin >> a >> b >> c;

	cout << a[0] << b[1] << c[2] << endl;
	return 0;
}


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

int main() {
  int a, b, c;
  int ans = 0;
  cin >> a;
  ans = 1;
  
  cin >> b;
  if(a != b) {
    ans++;
    cin >> c;
    if(a != c && b != c) ans++;
  } else {
    cin >> c;
    if (a != c) ans++;
  }
  cout << ans << endl;
}

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

int main() {
    ll N, K, S;
    cin >> N >> K >> S;
    if (K == 0) {
        if (S < 1000000){ 
            for (int i = 0; i < N; i++) {
                cout << S+1;
                if (i < N-1) cout << ' ';
                else cout << endl;
            }
        }else {
            for (int i = 0; i < N; i++) {
                cout << 1;
                if (i < N-1) cout << ' ';
                else cout << endl;
            }
        }
    }
    if (K > 0) {
        for (int i = 0; i < N; i++) {
            if (i < K) cout << S;
            else {
                if (S < 10000000) cout << 10000000;
                else cout << 1;
            }
            if (i < N-1) cout << ' ';
            else cout << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1280
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func allAtoi(num []string) []int {
	conv := make([]int, len(num))
	for i, item := range num {
		conv[i], _ = strconv.Atoi(item)
	}
	return conv
}

func main() {
	l := strings.Split(nextLine(), " ")
	meta := allAtoi(l)
	n := meta[0]
	limitW := meta[1]
	items := make([]item, n, n)
	for i := range items {
		d := strings.Split(nextLine(), " ")
		vw := allAtoi(d)
		items[i] = item{v: vw[0], w: vw[1]}
	}
	ans := solveOptimized(n, limitW, items)
	fmt.Println(ans)
}

type item struct {
	v int
	w int
}

func solveOptimized(n, limitW int, items []item) int {
	dp0 := make([]int, limitW+1, limitW+1)
	dp1 := make([]int, limitW+1, limitW+1)
	for i := 1; i <= n; i++ {
		v := items[i-1].v
		w := items[i-1].w
		dp1 = make([]int, limitW+1, limitW+1)
		for j := 0; j <= limitW; j++ {
			rest := j - w
			if rest >= 0 && dp0[j] < dp0[rest]+v {
				dp1[j] = dp0[rest] + v
			} else {
				dp1[j] = dp0[j]
			}
		}
		dp0 = dp1
	}
	return dp1[limitW]
}



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

int main(){
	int S,h,m,s;
	
	cin>>S;
	h=S/3600;
	m=(S-h*60*60)/60;
	s=S%60;
	
	
	
	cout<<h<<":"<<m<<":"<<s<<endl;
	
	
	
	
return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define arep(i, x, n) for (int i = int(x); i < (int)(n); i++)
#define rep(i, n) for (long long i = 0; i < n; ++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9 + 7
using ll = long long;

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

    string s;
    cin >> s;

    string output[n];
    int sum = 0;
    int sumB = 0;
    rep(i, n) {
        if (s.at(i) == 'a') {
            if (sum < a + c) {
                output[i] = "Yes";
                sum++;
            } else {
                output[i] = "No";
            }
        } else if (s.at(i) == 'b') {
            if (sum < a + c && sumB < c) {
                output[i] = "Yes";
                sum++;
                sumB++;
            } else {
                output[i] = "No";
            }
        } else {
            output[i] = "No";
        }
    }

    rep(i, n) { cout << output[i] << endl; }
}

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

using namespace std;

#define MOD 2019

int main(void)
{
    long long L, R;
    cin >> L >> R;
    R = min(R, L + MOD * 2);
    long long ans = MOD;
    long long i, j;
    for (i = L; i <= R; i++)
    {
        for (j = i + 1; j <= R; j++)
        {
            ans = min(ans, (i * j) % MOD);
        }
    }
    cout << ans << endl;;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  s.erase(unique(s.begin(),s.end()),s.end());
  cout << s.size() << endl;
}

Measured memory_bytes: 9588
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


int n;

int a,b;

void f(string s,string t){
  string sa=s;
  string sb=s;
  rep(i,s.size()){
    if(s[i]=='?'){
      sa[i]='a';
      sb[i]='z';
    }
  }

  if(sa>t) a++;
  if(sb<t) b++;
}

int main(){
  string s[11000],t;

  cin>>n;
  rep(i,n){
    cin>>s[i];
  }
  cin>>t;

  rep(i,n){
    f(s[i],t);
  }
  
//  cout<<a<<' '<<b<<endl;
  FOR(i,b+1,n-a+2){
    if(i>b+1) cout<<' ';
    cout<<i;
  }
  cout<<endl;

}


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
using namespace std;
int main(){
    string s;
    cin >> s;
    if (s[0]=='7' || s[1]=='7' || s[2]=='7')
    	cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  getline(cin,s);
  for(int i=0; i<s.size(); i++) if(s[i]>='a' && s[i]<='z') s[i]+='A'-'a';
  cout <<s<<endl;
  return 0;
}

Measured memory_bytes: 1172
# ABC140 C - Maximal Value

N = int(input())
B = list(map(int, input().split()))

A = []

A.append(B[0])

for i in range(N):
    if i > 0 and i <= N-2:
        A.append(min(B[i-1], B[i]))
    
A.append(B[N-2])

print(sum(A)) 

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
    ll n,W; cin>>n>>W;
    ll v[n+1],w[n+1];
    ll V=0;
    for(int i=1;i<=n;i++) { cin>>w[i]>>v[i]; V+=v[i]; }
    ll dp[n+1][V+1];
    for(ll i=0;i<=n;i++) dp[i][0]=0;
    for(ll i=1;i<=V;i++) dp[0][i]=-1;
    ll ans=0;
    for(ll i=1;i<=n;i++) {
        for(ll j=1;j<=V;j++) {
            ll a=dp[i-1][j];
          	ll b;
            if(j-v[i]>=0) b=dp[i-1][j-v[i]]; else b=-1;
            if(a==-1) {
                if(b==-1) dp[i][j]=-1; else dp[i][j]=b+w[i];
            }
            else {
                if(b==-1) dp[i][j]=a; else dp[i][j]=min(a,b+w[i]);
            }
            if(dp[i][j]!=-1 && dp[i][j]<=W && j>ans) ans=j;
            //cout<<dp[i][j]<<" ";
        }
    }
    cout<<ans;
}

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

using namespace std; using ll=long long; using P=pair<ll,ll>; const int INF=1e9; const ll LINF=1e18; const ll M=1e9+7;

ll gcd(ll a, ll b) {if (b==0) return a; else return gcd(b, a%b);}
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}

int main(){
  int n; cin>>n;
  map<P, ll> mp;
  ll aa=1, bb=1, an=1, only=0;
  for(int i=0;i<n;i++) {
    ll a,b; cin>>a>>b;
    if(a==0&&b==0) {only++; continue;}
    else if (a==0) {aa*=2; aa%=M; continue;}
    else if (b==0) {bb*=2; bb%=M; continue;}

    ll g = gcd(abs(a),abs(b));
    a/=g; b/=g;
    if (a<0) a*=-1, b*=-1;
    mp[{a,b}]++;
  }
  set<P> se; ll cc = 1; //cout<<endl;
  for(pair<P,ll> one : mp) {
    P x = one.first; ll val = one.second;
    //cout<<x.first<<" "<<x.second<<" "<<val<<endl;

    if (se.find(x) != se.end()) continue;
    ll s=-x.second, t=x.first;
    if (s<0) s*=-1, t*=-1;

    if (mp.find({s,t}) == mp.end()) {
      //cout<<"add "<<val+1<<"  "<<x.first<<" "<<x.second<<"  "<<s<<" "<<t<<endl;
      cc*=mod_pow(2,val); cc%=M;
    } else {
      ll val2 = mp[{s,t}];
      an*=(mod_pow(2, val)+mod_pow(2, val2)-1)%M; an%=M;
      se.insert({s,t});
      //cout<<"mul "<<val<<" "<<val2<<endl;
    }
  }
  //cout<<endl;
  
  //cout<<an<<" "<<aa<<" "<<bb<<" "<<cc<<" "<<only<<endl;

  an*=(aa+bb-1); an%=M;
  an*=cc; an+=M-1+only; an%=M;
  cout<<an<<endl;
}

Measured memory_bytes: 15960
/*      ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     */

// Author : Udit "luctivud" Gupta @ (https://www.linkedin.com/in/udit-gupta-1b7863135/)


#include <bits/stdc++.h>
#pragma GCC optimize "trapv"

using namespace std;

typedef long long int lld;
typedef unsigned long long int llu;


#define       TESTCASES()  cin >> (T3X0); T353 = T3X0; while(T3X0--)
#define       _input(V3C)  for(auto &V3C_I7 : (V3C)) cin >> (V3C_I7)
#define mems(A77AY, V4LU)  memset((A77AY), (V4LU), sizeof((A77AY)))
#define  CH3K(I7, E4, S7)  (((S7)<0) ? (I7)>(E4) : (I7)<(E4))
#define for4(I7,S4,E4,S7)  for(auto I7=(S4); CH3K(I7,E4,S7); (I7)+=(S7))




void solveEachTest(lld T35TC453N = 1) {

	vector <lld> occupied(100002ll, 0ll);
	lld n, k; cin >> n >> k;
	lld ans = 1ll;
	for4 (i, 0ll, n, 1ll) {
		ans = min(ans * 2, ans + k);
	}

	cout << ans;
	return;
}


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

	lld T3X0 = 0, T353 = 1;

	// TESTCASES()
	solveEachTest(T353 - T3X0);
	return 0;
}
// Random Thought :  null

Measured memory_bytes: 3944
#include <bits/stdc++.h>
using namespace std;
int main(){
    char c;
    cin >> c;
    if(c == 'a'|| c == 'i'|| c == 'u'|| c == 'e'|| c =='o'){
        cout << "vowel" << endl;
    }
    else{
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int table[50][26] = {0};
    for (int i = 0; i < n; ++i) {
        string s; cin >> s;
        for (int j = 0; j < s.size(); ++j) {
            table[i][s[j] - 'a']++;
        }
    }
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < 26; ++j) {
            if (table[i][j] > table[i - 1][j]) {
                table[i][j] -= table[i][j] - table[i - 1][j];
            }
        }
    }
    /*
    for (int i = 0; i < 26; ++i) {
        cout << table[n - 1][i] << " ";
        if (i == 25) cout << endl;
    }*/
    for (int i = 0; i < 26; ++i) {
        while (table[n - 1][i]) {
            table[n - 1][i]--;
            cout << (char)('a' + i);
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;

typedef long long int ll;
const ll MOD=1000000007;

ll n,k;
ll C[1001][1001]={};

int main(){
	scanf("%lld %lld",&n,&k);
	if(n<k) printf("0\n");
	else{
		for(int i=0;i<1001;i++){
			C[i][0]=1;
			C[i][i]=1;
			for(int j=1;j<i;j++){
				C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
			}
		}
		printf("%lld\n",C[n-1][k-1]);
	}
}


Measured memory_bytes: 10128
import sys
from collections import defaultdict
from operator import itemgetter
input = sys.stdin.readline

N = int(input())
d = defaultdict(int)
for _ in range(N):
    a, b = map(int, input().split())
    d[b] += a
task = list(d.items())
task.sort()

now = 0
ans = "Yes"
for limit, time in task:
    now += time
    if now > limit:
        ans = "No"
        break

print(ans)


Measured memory_bytes: 41916
#include <stdio.h>

int main(void){
  int N;
  scanf("%d",&N);

  int T[N];
  int sum = 0;
  for(int i = 0;i < N;i++){
    scanf("%d",&T[i]);
    sum += T[i];
  }

  int M;
  scanf("%d",&M);

  int p,x;
  for(int i = 0;i < M;i++){
    scanf("%d%d",&p,&x);
    printf("%d\n",sum-T[p-1]+x);
  }

  return 0;
}

Measured memory_bytes: 128
n, m = map(int, input().split())
L = 0
R = n + 1

for i in range(m):
  l, r = map(int, input().split())
  L = max(L, l)
  R = min(R, r)

if L <= R:
  print(R - L + 1)
else:
  print(0)

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

typedef long long ll;
const ll MOD = 1e9+7;
const int N = 2e5+5;

int a[N],b[N],n;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];

    for(int i=n/2+1;i<=n;i++)b[i]=a[i];
    for(int i=n/2;i>=1;i--){
        int c=0;
        for(int j=2*i;j<=n;j+=i)c+=b[j];
        if(a[i]==0){
            if(c%2==0)b[i]=0;
            else b[i]=1;
        }else{
            if(c%2==0)b[i]=1;
            else b[i]=0;
        }
    }

    vector<int>v;
    for(int i=1;i<=n;i++)if(b[i])v.push_back(i);

    for(int i=1;i<=n;i++){
        int c=0;
        for(int j=i;j<=n;j+=i){
            c+=b[j];
        }
        if(c%2!=a[i]){
            cout<<-1;
            return 0;
        }
    }



    cout<<(int)v.size()<<endl;
    for(auto e:v)cout<<e<<" ";
    return 0;
}


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

int main (){
  int a,b,c,x,j=0;
  cin >> a >> b >> c;
  for (int i=1; c>x; i++){
    j=i;
    x+=a;
    if (i%7==0){
      x+=b;
    }
  }
cout << j << endl;

  return 0;
}


Measured memory_bytes: 3120
import java.util.*

fun main(args: Array<String>) {
    val cin = Scanner(System.`in`)
    val A : Int = cin.nextInt()
    val B : Int = cin.nextInt()
    if ((A * B) % 2 == 0) {
        println("No")
    } else {
        println("Yes")
    }
    
}

Measured memory_bytes: 31392
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
	double Pi = 3.14159265359, a, b, r;
	scanf("%lf", &r);
	a = r * 2 * Pi;
	b = r * r * Pi;
	//ceil(a*1000000) / 1000000;
	//ceil(b*1000000) / 1000000;
	printf("%lf %lf\n", b, a);
	return 0;
}


Measured memory_bytes: 2056
#include <stdio.h>

int main(void){
	int n, d, flag[101] = { 0 };
	int i,count = 0;

	scanf("%d", &n);
	for (i = 0; i < n; ++i){
		scanf("%d", &d);
		flag[d] = 1;
	}
	for (i = 0; i < 101; ++i){
		count += flag[i];
	}

	printf("%d\n", count);

	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	LLi n, x, y, ma=-1;
	vector<LLi> v1, v2, v3, v4;

	cin>> n;
	v1.resize(n);
	v2.resize(n);
	v3.resize(n);
	v4.resize(n);

	rep(i, n){
		cin >> x >> y;
		v1[i]=x;
		v2[i]=y;
		v3[i]=x+y;
		v4[i]=x-y;
	}
	
	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());
	sort(v3.begin(), v3.end());
	sort(v4.begin(), v4.end());

	ma=max(ma, v1[n-1]-v1[0]);
	ma=max(ma, v2[n-1]-v2[0]);
	ma=max(ma, v3[n-1]-v3[0]);
	ma=max(ma, v4[n-1]-v4[0]);

	cout<< ma << endl;
 
	return 0;
}

Measured memory_bytes: 9588
n = gets.to_i
arr = gets.chomp.split(" ").map(&:to_i)
exchange_times = 0
n.times do |i|
  minj = i
  for j in i..(n-1)
    if arr[j] < arr[minj]
      minj = j
    end
  end
  if arr[i] != arr[minj]
    org_arr_i = arr[i]
    arr[i] = arr[minj]
    arr[minj] = org_arr_i
    exchange_times += 1
  end
end

puts arr.join(' ')
puts exchange_times


Measured memory_bytes: 6872
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, a: "List[int]"):
    sv = sum(a)/N
    p = 0
    s = INF
    for i in range(N):
        if abs(sv - a[i]) < s:
            p = i
            s = abs(sv - a[i])
        
    print(p)
    
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N - 1 - 0 + 1)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
#include <set>
#include <iomanip>
#include <vector>
using namespace std;
typedef long long ll;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
#define MAX_V 100001
#define MOD 1000000007
typedef vector<vector<int> > Graph;
int p[1000];

int main(){
    string s;cin>>s;
    int count_a=0;
    int flag=-1;
    int ren=1;
    ll ans=0;
    for(int i=0;i<s.size();i++){
        if(flag>0){
            flag--;
            continue;
        }
        if(s[i]=='A'){
            count_a++;
            continue;
        }
        if(count_a>0&&i+1<s.size()&&s[i]=='B'&&s[i+1]=='C'){
            ans+=count_a;
            flag=1;
        }
        else{
            count_a=0;
        } 
    }
    cout<<ans<<endl;
}
 



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

int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int counter=1;
    while(a>0&&c>0)
    {
        if(counter%2==1)
        {
            c-=b;
        }
        else
        {
            a-=d;
        }
        counter++;
        if(a<=0)
        {
            cout<<"No"<<endl;
            return 0;
        }
        else if(c<=0)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < (n); i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, k, n) for (int i = (k); i < (n); i++)
#define REPEACH(itr, k) for (auto &&itr : k)

using namespace std;
typedef long long ll;


const ll INF = 1ll << 60;
const ll MOD = 1000000007;

ll cmb(int n, int k)
{
    ll coef = 1;
    vector<ll> sieve(n + 1, 0);
    if (n < k)
    {
        coef = 0;
        return coef;
    }
    if (n == k || k == 0)
    {
        coef = 1;
        return coef;
    }
    k = min(k, n - k);
    for (ll p = 2; p <= n; p++)
    {
        if (sieve.at(p) == 0)
        {
            for (ll i = p * p; i <= n; i += p)
            {
                sieve.at(i) = 1;
            }
            for (ll prime = p; prime <= n; prime *= p)
            {
                ll cnt = n / prime - k / prime - (n - k) / prime;
                REP(j, cnt)
                {
                    coef *= p;
                    coef %= MOD;
                }
            }
        }
    }
    return coef;
}
int main()
{
    int n,k;
    cin >> n >> k;
    for(int i=1;i<=k;i++){
        ll tmp=cmb(k-1,i-1)*cmb(n-k+1,i)%MOD;
        cout << tmp << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n,m;
int a[200005],b[200005];
int c[200005];
int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        if(a[i]==1){
            c[b[i]]++;
        }else if(b[i]==n){
            c[a[i]]++;
        }
    }
    for(int i=0;i<=n;i++){
        if(c[i]==2){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;

}


Measured memory_bytes: 5836
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,n); for(long long i = 0;i < (n);i++)
using ll = long long;
using P = pair<long long,long long>;
template <class T> using vec = vector<T>;
template<class T>void sort(vec<T> &v){sort(v.begin(),v.end());}
template<class T>void rsort(vec<T> &v){sort(v.rbegin(),v.rend());}
const ll mod = 1e9+7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m; cin >> n >> m;
    vec<ll> h(n); rep(i,n)cin >> h[i];
    vec<bool> g(n,1);
    rep(i,m){
        ll a,b; cin >> a >> b; --a; --b;
        if(h[a] == h[b]){
            g[a] = 0; g[b] = 0;
        }
        h[a] > h[b] ? g[b] = 0 : g[a] = 0;
    }
    ll ans = 0;
    rep(i,n)if(g[i])++ans;
    cout << ans << endl;
}

Measured memory_bytes: 3992
#include"bits/stdc++.h"
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
typedef pair<int, int> P;

lint N;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	lint v = (lint)1e9;
	lint x = (v - N % v) % v;
	lint y = (N + x) / v;
	cout << "0 0 1000000000 1 " << x << " " << y << endl;
}


Measured memory_bytes: 256