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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 100007;

int n, l, t;
int x[MAXN], d[MAXN];
int ans[MAXN];

void init ();
void input ();
void work ();

int divi ( int x, int y )
{
	if ( x < 0 ) return -1;
	else return x / y;
}



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here

	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method

	scanf ( "%d%d%d", &n, &l, &t );
	lpi ( i, 1, n ) scanf ( "%d%d", &x[i], &d[i] );
}

void work ()
{
	// main work

	lpi ( i, 1, n ){
		if ( d[i] == 1 ) ans[i] = ( x[i] + t ) % l;
		else ans[i] = ( ( x[i] - t ) % l + l ) % l;
	}

	int tp1 = ans[1];
	sort ( ans+1, ans+1+n );
	int p1 = -1;
	lpi ( i, 1, n ) if ( ans[i] == tp1 ) { p1 = i; break; }

	LL cc = 0;
	if ( d[1] == 1 ){
		lpi ( i, 1, n ){
			if ( d[i] == 2 ) cc += divi ( ( 2 * t - ( x[i] - x[1] + 1 ) ), l ) + 1;
		}
	} else if ( d[1] == 2 ){
		lpi ( i, 1, n ){
			if ( d[i] == 1 ) cc -= divi ( ( 2 * t - ( x[1] + l - x[i] + 1 ) / 2 * 2 ), l ) + 1;
		}
	}

	cc %= n;
	( cc += n ) %= n;

	p1 -= cc;
	if ( p1 <= 0 ) p1 += n;
	lp ( i, 0, n ) printf ( "%d\n", ans[( p1+i-1 )%n+1] );
}

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

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop0(i,n) for(int i=0; i<(n); i++)
#define loop1(i,n) for(int i=1; i<=(n); i++)
#define fori(a,b,i) for(int i=(a); i<=(b); i++)
#define ford(a,b,i) for(int i=(a); i>=(b); i--)
#define fast_io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define ign cin.ignore(numeric_limits<streamsize>::max(),'\n')

#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define endl "\n"
#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef map<int,int> MCI;
typedef unordered_map<int,int> UMII;
typedef unordered_map<char,int> UMCI;
typedef set<int> SI;
typedef long long int llint;


int main() {
    fast_io;
	llint n;
	cin >> n;
	vector<llint> v(n);
	unordered_map<llint, llint> m; 
	llint sum=0;
	for(auto &i : v) {cin >> i;sum+=i;}
	for (llint i = 0; i < n; i++) m[v[i]]++;  
	llint q;
	cin >> q;
	
	for(llint i = 0; i < q; i++){
		llint a,b;
		cin >> a >> b ;
		
		sum = sum - (1LL*a*m[a]) +(1LL*b*m[a]);
		
		m[b] += m[a];
		
		m[a] = 0;

		cout << sum << endl;		
	}
	
}


Measured memory_bytes: 7904
//ABC042B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int n, l;
	cin >> n >> l;
	vector<string> s(n);
	for(int i=0;i<n;i++){
		cin >> s.at(i);
	}
	sort(s.begin(),s.end());
	string ans = "";
	for(int i=0;i<n;i++){
		ans += s.at(i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    rep(i, N) cin >> A.at(i);

    sort(A.begin(), A.end(), greater<int>());

    int sumOfVotes = 0;
    rep(i, N) {
        sumOfVotes += A.at(i);
    }

    double minOfVotes = (double)sumOfVotes / (4 * M);

    string ans = "Yes";
    rep(i, M) {
        if (A.at(i) < minOfVotes) ans = "No";
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int lli;
#define optimize ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define pii pair<int,int>
#define mii map<int,int>
#define F first
#define S second
#define forn(i,n) for(int i = 0; i<n; i++)
#define forab(i,a,b) for(int i = a; i<b; i++)
#define forll(i,a,b) for(lli i = a; i<b; i++)
#define mp make_pair
#define pb push_back
#define sortv(v) sort(v.begin(), v.end())
#define debug(x) cout<<#x<<" : "<<x<<endl
#define all(x) x.begin(),x.end()
#define printv(v) for(auto it : v) cout<<it<<" ";cout<<endl;
#define prec(n) fixed<<setprecision(n)
const lli mod1 = 1000000007;
const int mod2 = 998244353;
const int N = 1e5;

int main()
{
	optimize

	#ifndef ONLINE_JUDGE
	freopen("inputf.in", "r", stdin);
	freopen("outputf.in", "w", stdout);
	#endif

	int n;
	cin>>n;
	vector<lli>a(n);
	forn(i,n) cin>>a[i];

	vector<lli>pref(n+1,0LL);
	forab(i,1,n+1)
		pref[i] = (pref[i-1]+a[i-1])%mod1;

	lli res = 0LL;

	forn(i,n-1)
	{
		res = (res + (a[i]*(pref[n]-pref[i+1]+mod1)%mod1)%mod1)%mod1;
	}

	cout<<res<<endl;



	return 0;
}

Measured memory_bytes: 6360
while True:
    count=0
    sum=0
    a,b=map(int,input().split())
    if a==0 and b==0:
        break

    for i in range(1,a+1):
        sum+=i
        for j in range(i+1,a+1):
            sum+=j
            for k in range(j+1,a+1):
                sum+=k
                if sum==b:
                    count+=1
                sum-=k
            sum-=j
        sum=0
    print(count)



Measured memory_bytes: 5596
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    // freopen("in.txt","r",stdin);
    int ans=0;
    int M,D;scanf("%d %d",&M,&D);
    for(int i=1;i<=M;i++)
    {
        for(int j=22;j<=D;j++)
        {
            int day10=j/10;
            int day01=j%10;
            // printf("%d %d %d\n",i,day01,day10);
            if((day10>=2)&&(day01>=2)&&(i==day01*day10)) ans+=1;
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;
typedef pair<int,int> P;

const long long int mod=1e9+7;



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

	string s[100010];
	REP(i,N){
		cin >> s[i];
		std::sort(s[i].begin(), s[i].end());
	}
	sort(s,s+N);

	lint num=1;
	lint ans=0;

	REP(i,N-1){
		if(s[i]==s[i+1]){
			num+=1;
		}else{
			if(num>1){
				lint sum = 0;
				for (lint j = 1; j <= num-1; ++j)
				{
					sum += j;
				}

				ans+=sum;
			}
			num=1;
		}
	}

	if(num>1){
		lint sum = 0;
		for (lint j = 1; j <= num-1; ++j)
		{
			sum += j;
		}

		ans+=sum;
	}


	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 7296
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a>b&&b>c){
		cout<<a*10+b+c<<endl;
	}
	else if(a>c&&c>b){
		cout<<a*10+b+c<<endl;
	}
	else if(a==b&&b>c){
		cout<<a*10+b+c<<endl;
	}
	else if(a==c&&c>b){
		cout<<a*10+b+c<<endl;
	}
	else if(a>b&&b==c){
		cout<<a*10+b+c<<endl;
	}
	else if(a==b&&b==c){
		cout<<a*10+b+c<<endl;
	}
	else if(b>a&&a>c){
		cout<<b*10+a+c<<endl;
	}
	else if(b>c&&c>a){
		cout<<b*10+a+c<<endl;
	}
	else if(b==c&&c>a){
		cout<<b*10+a+c<<endl;
	}
	else if(b>a&&a==c){
		cout<<b*10+a+c<<endl;
	}
	else if(c>a&&a>b){
		cout<<c*10+a+b<<endl;
	}
	else if(c>b&&b>a){
		cout<<c*10+a+b<<endl;
	}
	else{
		cout<<c*10+a+b<<endl;
	}
	return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int x = c - a; // 4
  int y = d - b; // 3
  cout << c - y;
  cout << " ";
  cout << d + x;
  cout << " ";
  cout << a - y;
  cout << " ";
  cout << b + x;
}

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

int main() {
  int N;
  int d[110];
  cin>>N;
  for(int i=0;i<N;i++) cin>>d[i];
  
  int num[110]={0};
  for(int i=0;i<N;i++){
   num[d[i]]++;
  }
  
   int res=0;
   for (int i = 1; i <= 100; ++i){
    if(num[i]>0){
     res++;
   }
  }cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

long long a[200005];
int b[200005];
int main(){
    int n;
    long long k;
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];b[i]=0;
    }
    int i=1, x=1;
    while( k--){
        b[i]=x;
        i=a[i];
        if(b[i] >= 1){
            k=k%(x-b[i]+1);
        }
        x++;
    }
    cout<<i<<endl;
    return 0;
}

Measured memory_bytes: 5976
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
A = IL()

d = DD(int)
for a in A:
  d[a] += 1
keys = [k for k in d]
P(max(d[k-1] + d[k] + d[k+1] for k in keys))

Measured memory_bytes: 64672
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int n;
    int[] as;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        as = new int[n];
        for (int i = 0; i < n; i++) {
            as[i] = sc.nextInt();
        }
        solve();
    }

    void solve() {
        int[] counts = new int[100001];
        for (int i = 0; i < n; i++) {
            if (as[i] > 0) {
                counts[as[i] - 1]++;
            }
            counts[as[i]]++;
            counts[as[i] + 1]++;
        }
        int max = 0;
        for (int i = 0; i < 100001; i++) {
            if (counts[i] > max) {
                max = counts[i];
            }
        }
        System.out.println(max);
    }

    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;
        }
    }
}


Measured memory_bytes: 37824
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    vector<int> l(n);
    for(int i=0; i<n; i++) cin>>l[i];

    sort(l.begin(), l.end());

    ll ans = 0;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            int lmin = l[i], lmid = l[j];
            int add = lmin + lmid;

            int ok = j, ng = n;
            while(ng - ok > 1){
                //cout << ok << " " << ng << endl;
                int mid = (ok + ng) / 2;
                if(l[mid] >= add) ng = mid;
                else ok = mid;
            }

            ans += ok - j;
        }
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int M[600001], L[600001], R[600001], t=1;

int Maxi(int l, int r, int I)
{
    if (l <= L[I] && R[I] <= r)
    {
        return M[I];
    }
    else if ((L[I] <= l && l <= R[I]) || (L[I] <= r && r <= R[I]))
    {
        return max(Maxi(l, r, 2*I), Maxi(l, r, 2*I+1));
    }
    else
    {
        return 0;
    }
}

void Update(int I, int a)
{
    I += t-1;
    M[I] = a;
    I /= 2;
    while (I >= 1)
    {
        M[I] = max(M[2*I], M[2*I+1]);
        I /= 2;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, I, I2;
    cin >> n;
    int X[n+1], D[n+1];
    L[1] = 1;
    R[1] = 262144;
    M[1] = -1;
    while (L[t] != R[t])
    {
        L[2*t] = L[t];
        R[2*t] = (L[t] + R[t]) / 2;
        L[2*t+1] = (L[t] + R[t]) / 2 + 1;
        R[2*t+1] = R[t];
        M[2*t] = -1;
        M[2*t+1] = -1;
        t++;
    }
    vector <pair<int, int>> V;
    set <pair<int,int>> Se;
    long long Dp[n+2], mod=998244353;
    for (int i = 1; i <= n; i++)
    {
        cin >> X[i] >> D[i];
        V.push_back({X[i],i});
    }
    Se.insert({2100000000,n+1});
    sort(V.begin(),V.end());
    Dp[n+1] = 1;
    for (int i = n; i >= 1; i--)
    {
        I = V[i-1].second;
        set <pair<int,int>> :: iterator it;
        Se.insert({X[I],i});
        it = Se.lower_bound({X[I]+D[I],-1});
        it--;
        Update(i, i);
        I2 = Maxi(i, it->second, 1);
        Dp[i] = Dp[i+1] + Dp[I2+1];
        Dp[i] %= mod;
        Update(i, I2);
    }
    cout << Dp[1];
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

#define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i];
#define vvint(v, w, n) vector<int> v(n); vector<int> w(n); REP(i,n) cin >> v[i] >> w[i];
#define vlint(v, n) vector<ll int> v(n); REP(i,n) cin >> v[i];
#define vdouble(v, n) vector<double> v(n); REP(i,n) cin >> v[i];
#define vvdoube(v, n1, n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j];
#define string(x) string x; cin >> x;
#define vstring(v, n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); }

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).begin(), (v).end(), std::greater<int>()
#define len(v) (v).length()
#define FIND(s, n) (s.find(n) != s.end())
#define SORT(a) sort(all(a))

static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
static const long long MOD = 1000000007;
static const double PI=3.1415926535897932;
static const int INF = 0x3f3f3f3f;
static const int INFTY = (1 << 29);
static const long long LINFTY = (1LL << 32);

static const int dy4[]={0, 0, 1, -1};
static const int dx4[]={1, -1, 0, 0};
static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1};
static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};


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

	int n;
	cin >> n;

	if(n >= 1200) cout << "ARC" << endl;
	else cout << "ABC" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);
    
    int n, a, b, c, d;
    string s;
    cin >> n >> a >> b >> c >> d;
    cin >> s;

    if (s[c-1] == '#' || s[d-1] == '#' || c == d) {
        cout << "No" << endl;
        return 0;
    }

    bool ans = true;
    for (int i = a; i < c-1; i++) {
        if (s[i] == '#' && s[i] == s[i+1]) ans = false;
    }
    for (int i = b; i < d-1; i++) {
        if (s[i] == '#' && s[i] == s[i+1]) ans = false;
    }

    bool ok = true;
    if (c > d) {
        ok = false;
        for (int i = b - 1; i < d; i++) {
            if (s[i-1] == '.' && s[i-1] == s[i] && s[i-1]== s[i+1]) ok = true;
        }
    }

    if (ans && ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3164
import java.util.*;

public class Main {
    //-------------------------------------------------------------//
    public static final void main(String[] args) { new Main().solve(); }
    //-------------------------------------------------------------//
    Scanner sc = new Scanner(System.in);
    void solve() {
        int N = sc.nextInt();
        int T = sc.nextInt();
        int[] t = new int[N];
        for (int i = 0; i < N; i++) t[i] = sc.nextInt();
        int ans = N * T;
        for (int i = 0; i < N - 1; i++) {
            int d = t[i + 1] - t[i];
            if (d >= T) continue;
            ans -= T - d;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 66640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) (V).begin(),(V).end()

vector<vector<ll>> T(100000);
vector<ll> A(100000);

bool j = false;
ll solve(int x, int y) {
	if (j)return 0;
	int ss = T[y].size();
	if (ss == 1)
		return A[y];
	ll cnt = 0, mcnt = 0, a;
	for (int i = 0;i < ss;i++) {
		if (T[y][i] == x)continue;
		a = solve(y, T[y][i]);
		cnt += a;
		mcnt = max(a, mcnt);
		if (j)break;
	}
	ll ans = A[y] * 2 - cnt;
	if (ans > cnt || ans < max(2 * mcnt - cnt, (ll)0))
		j = true;
	if (j)return 0;
	return ans;
}

int main() {
	ll N;
	cin >> N;
	for (int i = 0;i < N;i++) {
		cin >> A[i];
	}
	int a, b;
	for (int i = 0;i < N - 1;i++) {
		cin >> a >> b;
		a--; b--;
		T[a].push_back(b);
		T[b].push_back(a);
	}
	ll a1 = solve(a, b);
	ll a2 = solve(b, a);
	if (j) a1 = -512411;
	if (a1 == a2)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 14336
n=gets.to_i
x=gets.split.map(&:to_i)
m = 10000000000000000000
for i in 1..100
    s = 0
    for j in 0...n
        s += (x[j]-i)*(x[j]-i)
    end
    m = (m<s)?m:s
end
p m



Measured memory_bytes: 1788
#include <cstdio>

long long int n, k;
long long int v[100010];
long long int sum;

int main(){
	scanf("%lld %lld", &n, &k);
	for(int i=0; i<n; ++i){
		int a, b;
		scanf("%d %d", &a, &b);
		v[a] += b;
	}
	for(int i=0; i<100010; ++i){
		sum += v[i];
		if(k <= sum){
			printf("%d\n", i);
			break;
		}
	}
}

Measured memory_bytes: 896
def main():
    k = int(input())
    res = 1
    s = 7
    used = []
    if k % 2 == 0 or k % 5 == 0:
        return -1
    while True:
        s = s % k
        if s == 0:
            return res
        else:
            s = s*10+7
            res += 1

    
 
if __name__ == '__main__':
    print(main())

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

int main()
{ 
    int n;
    cin>>n;
    string x;
    string y;
    
    int a=0;
    int b=0;

    while(cin>>x){
    cin >>y;
 
    if(y==x) {
      a+=1;
      b+=1;}
    else if(y>x)
    {b+=3;}
    else if(y<x)
    {a+=3;}
    }
cout<<a<<" "<<b<<endl;


    return 0;
}


Measured memory_bytes: 3148
from heapq import heappush, heappop
import re
from collections import deque
import sys
input = sys.stdin.readline


def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return tuple(map(int, ss_raw()))


DIV = 10**9+7


def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def ncr(n, r, mod=DIV):
	r = min(r, n-r)
	ret = 1
	for i in range(1, r+1):
		ret = ret * (n-i+1) % mod
		ret = ret * mod_inv(i, mod) % mod
	return ret


def main():
    N,A,B = ints_raw()
    c1 = N*A
    c2 = B
    return min(c1,c2)

print(main())


Measured memory_bytes: 38384
// 2016/04/27 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int H;
		cin >> H;

		if(H==0)
			break;

		int S[10][5];
		for(int i=0; i<H; i++){
			for(int j=0; j<5; j++){
				cin >> S[i][j];
			}
		}

		int sco = 0;

	while(true){
		bool flg = false;

		for(int i=0; i<H; i++){
			if(S[i][2]==0)
				continue;

			if(S[i][2]==S[i][0] && S[i][2]==S[i][1] && S[i][2]==S[i][3] && S[i][2]==S[i][4]){
				sco += (S[i][2]*5);
				S[i][2] = S[i][0] = S[i][1] = S[i][3] = S[i][4] = 0;
				flg = true;
			}
			else if(S[i][2]==S[i][0] && S[i][2]==S[i][1] && S[i][2]==S[i][3]){
				sco += (S[i][2]*4);
				S[i][2] = S[i][0] = S[i][1] = S[i][3] = 0;
				flg = true;
			}
			else if(S[i][2]==S[i][1] && S[i][2]==S[i][3] && S[i][2]==S[i][4]){
				sco += (S[i][2]*4);
				S[i][2] = S[i][1] = S[i][3] = S[i][4] = 0;
				flg = true;
			}
			else if(S[i][2]==S[i][0] && S[i][2]==S[i][1]){
				sco += (S[i][2]*3);
				S[i][2] = S[i][0] = S[i][1] = 0;
				flg = true;
			}
			else if(S[i][2]==S[i][1] && S[i][2]==S[i][3]){
				sco += (S[i][2]*3);
				S[i][2] = S[i][1] = S[i][3] = 0;
				flg = true;
			}
			else if(S[i][2]==S[i][3] && S[i][2]==S[i][4]){
				sco += (S[i][2]*3);
				S[i][2] = S[i][3] = S[i][4] = 0;
				flg = true;
			}
		}

		if(!flg)
			break;

		for(int j=0; j<5; j++){
			for(int i=H-1; i>=0; i--){
				if(S[i][j]!=0)
					continue;

				for(int k=i-1; k>=0; k--){
					if(S[k][j]!=0){
						S[i][j] = S[k][j];
						S[k][j] = 0;
						break;
					}
				}
			}
		}
/*
		for(int i=0; i<H; i++){
			for(int j=0; j<5; j++){
				cout << S[i][j];
			}
			cout << endl;
		}
*/
	}

		cout << sco << endl;
	}

	return 0;
}

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

#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)

bool isMM(int num){
    if(num>=1 &num<=12){
        return true;
    }
    return false;
}

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

    string f=s.substr(0,2);
    string b=s.substr(2,2);

    int fi = stoi(f);
    int bi = stoi(b);

    string ans ="NA";
    if(isMM(fi)){
        if(isMM(bi)) ans ="AMBIGUOUS";
        else ans="MMYY";
    }else if(isMM(bi)){
        ans="YYMM";
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#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()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    int sum = 0;
    int res = 0;
    F0R(i, N) {
        int cur; cin >> cur; sum += cur;
        res -= cur*cur;
    }
    res += sum*sum; res /= 2;
    cout << res << endl;

	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a, b, c) = readLine()!!.split(" ").map { it.toInt() }
    val arr = listOf(a, b, c)

    var ans = "Yes"

    for (i in 1 until arr.size) {
        if (arr[i - 1] >= arr[i]) ans = "No"
    }

    println(ans)
}



Measured memory_bytes: 31996
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
//#define int long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (10);   小数点以下１０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);

int main() {
  int n;
  cin >>n;
  
  vector<int> p(n);
  
  int ans = 0;
  rep(i,n) {
  cin >> p[i];
  }
  
  repo(i,n-1) {
    if((p[i-1]<p[i] && p[i]<p[i+1])||(p[i-1]>p[i] && p[i]>p[i+1])) ans++;
  }
  
  cout << ans << endl;
  
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt() - 1;
        }
        boolean[] visited = new boolean[n];
        int count = 0;
        int cur = 0;
        visited[cur] = true;
        while (true) {
            ++count;
            int next = a[cur];
            if (visited[next]) {
                System.out.println(-1);
                return;
            }
            if (next == 1) {
                System.out.println(count);
                return;
            }

            visited[next] = true;
            cur = next;
        }
    }
}

Measured memory_bytes: 49964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int N;
    cin >> N;
    vector<int> a(N+3);
    for(int i = 1; i <= N; i++){
        cin >> a.at(i);
    }

    vector<int> ans(N+3);
    int tmp = 0;
    for(int i = N; i >= 1; i--){
        tmp = a.at(i);
        for(int j = 2; i*j <= N; j++){
            tmp += ans.at(i*j);
        }
        ans.at(i) = tmp % 2;
    }

    int M = 0;
    for(int i = 1; i <= N; i++){
        M += ans.at(i);
    }
    printf("%d\n", M);
    for(int i = 1; i <= N; i++){
        if(ans.at(i) == 1){
            printf("%d ", i);
        }
    }


}



Measured memory_bytes: 2432
n = int(input())
x = list(map(int, input().split()))

x_mean = sum(x)/n
p1 = int(x_mean)
p2 = p1 + 1

if abs(x_mean - p1) > abs(x_mean - p2):
    p = p2
else:
    p = p1

ans = 0
for i in range(n):
    ans += (x[i]-p)**2
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>

using namespace std;



int main() {

	int n;
	cin >> n;
	double t, a;
	cin >> t >> a;

	int min_num = 0;
	double min = INT_MAX;

	for (int i = 1; i <= n; i++) {
		double x;
		cin >> x;
		if (min > fabs(a - (t - 0.006*x))) {
			min = fabs(a - (t - 0.006*x));
			min_num = i;
		}
	}

	cout << min_num << endl;

	return 0;

}

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

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

Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) begin(v), end(v)
#define REV(v) rbegin(v), rend(v)
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second

using namespace std;

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

int w, h;

const int N = 20;
int v[N][N];

inline bool in(int x, int y){
	return  0 <= x && x < w && 0 <= y && y < h;
}

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

int ans;
void dfs(int i, int x, int y){
	if (ans < i) return;
	if (i == 10) return;

	rep(d, 4){
		int nx = x + dx[d], ny = y + dy[d];
		if (in(nx, ny) && v[ny][nx] == 1) continue;
		while (in(nx, ny) && v[ny][nx] == 0){
			nx += dx[d], ny += dy[d];
		}
		if (!in(nx, ny)) continue;
		if (v[ny][nx] == 3){
			ans = min(ans, i + 1);
			break;
		}
		else{
			v[ny][nx] = 0;
			dfs(i + 1, nx - dx[d], ny - dy[d]);
			v[ny][nx] = 1;
		}
	}
}

int main(){
	while (cin >> w >> h, w){
		rep(i, h) rep(j, w) cin >> v[i][j];
		ans = 100;
		rep(i, h) rep(j, w) if (v[i][j] == 2) v[i][j] = 0, dfs(0, j, i);
		cout << (ans == 100 ? -1 : ans) << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()

f = [0] * 1000005
for v in a:
    f[v] += 1
for i in range(1000000, 0, -1):
    if f[i] == 0:
        continue
    j = i*2
    while j <= 1000000:
        f[j] += f[i]
        j += i
ct = 0
for v in a:
    if f[v] == 1:
        ct += 1
print(ct)


Measured memory_bytes: 121356
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
typedef long long ll;
using namespace std;

int main() {
	int r;
	cin >> r;
	float c;
	c=2*r*M_PI;
	printf("%.2f",c);
	return 0;
}

Measured memory_bytes: 3772
#include <stdio.h>

int main(){
  int a;
  scanf("%d", &a);
  a = a % 10;
  
  switch(a){
    case 3:
      puts("bon");
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      puts("pon");
      break;
    default:
      puts("hon");
      break;
  }
  
  return 0;
}

Measured memory_bytes: 1664
# coding: utf-8
from itertools import permutations
from math import sqrt

def calc(x0, y0, x1, y1):
    return sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2)

N = int(input())
X, Y = [], []
for i in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
    
ll = list(permutations(range(N)))
ls =[]

for l in ll:
    tmp = 0
    x0, y0 = X[l[0]], Y[l[0]]
    for j in range(1, N):
        x1, y1 = X[l[j]], Y[l[j]]
        tmp += calc(x0, y0, x1, y1)
        x0, y0 = x1, y1
    ls.append(tmp)
    
print(sum(ls) / len(ll))


Measured memory_bytes: 49260
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
	vector<int>A(3);
	for (int i = 0; i < 3; i++) cin >> A.at(i);
	sort(A.begin(), A.end());
	if (A.at(0) + A.at(1) == A.at(2))cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int c[4];

int main() {
    int i;
    
    for (i = 0; i < 3; i++) {
        int a, b;
        
        scanf("%d %d", &a, &b);
        
        a--;
        b--;
        
        c[a]++;
        c[b]++;
    }
    
    sort(c, c + 4);
    
    if (c[0] == 1 && c[1] == 1 && c[2] == 2 && c[3] == 2) {
        puts("YES");
    } else {
        puts("NO");
    }
    
    return 0;
}


Measured memory_bytes: 128
n=int(input())
x=list(map(int,input().split()))

y=list(map(int,input().split()))
z=[0]*n
a=0
b=0
c=0
d=0
for i in range(n):
    a=a+abs(x[i]-y[i])
    b=b+(x[i]-y[i])**2
    c=c+abs(x[i]-y[i])**3
    z[i]=abs(x[i]-y[i])
print(f'{a:.10f}')
b=b**(1/2)
print(f'{b:.10f}')
c=c**(1/3)
print(f'{c:.10f}')
print(f'{max(z):.10f}')


Measured memory_bytes: 5660
#include<iostream>
using namespace std;
int main()
{
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r;

    if(r<=x && x<=W-r && r<=y && y<=H-r){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;

}


Measured memory_bytes: 3084
#include <vector>
#include <iostream>
#include <iomanip>
#include <algorithm>

using namespace std;
using ll = long long;

int main()
{
    int N;
    cin >> N;
    using P = pair<ll, ll>;
    vector<P> p(N);
    for (int i = 0; i < N; i++) {
        cin >> p[i].first >> p[i].second;
    }
    if (N % 2 == 1) {
        cout << "NA" << endl;
        return 0;
    }

    sort(p.begin(), p.end());
    ll xsum = p[0].first + p[N - 1].first;
    ll ysum = p[0].second + p[N - 1].second;
    for (int i = 1; i < N / 2; i++) {
        if (xsum != p[i].first + p[N - 1 - i].first or ysum != p[i].second + p[N - 1 - i].second) {
            cout << "NA" << endl;
            return 0;
        }
    }
    cout << fixed << setprecision(10) << (long double)(xsum) / 2 << " " << (long double)(ysum) / 2 << endl;

    return 0;
}

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

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

  vector<int> a(N, 0);
  rep(i, N) cin >> a[i];

  int j = 1;
  rep(i, N) {
    if (a[i] == j) {
      j++;
    }
  }

  if (j == 1) {
    cout << -1 << endl;
  } else {
    cout << N - j + 1 << endl;
  }
}

Measured memory_bytes: 4052
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define ALL(x)					(x).begin(),(x).end()
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
ll execOne(ll n, ll keta)
{
	ll ans = 0;

	if (keta == 1) {
		return n;
	}
	while (0 != n) {
		ans += n % keta;
		n /= keta;
	}
	return ans;
}

int main()
{
	ll n, s;
	cin >> n >> s;

	if (s == n) {
		cout << n + 1 << endl;
		return 0;
	}
	if (s > n) {
		cout << -1 << endl;
		return 0;
	}
	
	for (ll b = 2; b <= sqrt(n); b++) {
		if (s == execOne(n, b)) {
			cout << b << endl;
			return 0;
		}
	}
	
	// pb + q = n;
	//  p + q = s;
	//p(b - 1) = n - s;
	ll ns = n - s;
	for (ll p = sqrt(n); p >= 1; p--) {
		if (ns % p == 0) {
			ll b = ns / p + 1;
			if (s == execOne(n, b)) {
				cout << b << endl;
				return 0;
			}
		}
	}

	cout << -1 << endl;
	return 0;
}



Measured memory_bytes: 256
def gcd(m, n):
  x = max(m, n)
  y = min(m, n)
  if x % y == 0:
    return y
  else:
    while x % y != 0:
      z = x % y
      x = y
      y = z
    else:
      return z
n = int(input())
a = list(map(int, input().split()))
lsize = len(a)
bef = a[0]
for i in range(1, lsize):
  bef = gcd(bef,a[i])
hp = bef
print(hp)

Measured memory_bytes: 14252
a,b,k=map(int,input().split())
A=a
B=b
if a>=k:
    A=a-k
elif a<k:
    B=b-(k-a)
    A=0
    if k-a>=b:
        B=0
else:
    A=0
    B=0
    
print(A,B)

Measured memory_bytes: 3060
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

int n;

int read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  return true;
}

const int maxx = (int) 3e4;

void solve() {
  if (n == 3) {
    printf("%d %d %d\n", 2, 5, 63);
    return;
  }
  printf("%d %d ", 3, 9);
  int rem = n - 2;
  {
    int x = 15;
    while (rem >= 4 && x + 6 <= maxx) {
      printf("%d %d ", x, x + 6);
      x += 12;
      rem -= 2;
    }
  }
  for (int i = 0; i < rem - 1; i++) {
    printf("%d ", 2 * (i + 1));
  }
  if (rem % 3 != 1) {
    printf("%d\n", 2 * rem);
  } else {
    printf("%d\n", 2 * (rem + 2));
  }
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib> //abs　絶対値

using namespace std;

int main() {
	int n, ans;
	cin >> n;
	//vector <int> A(n);
	//for (int i = 0; i < n; i++) {
		//cin >> A[i];
	//}
	
	//sort(A.begin(), A.end());

	cout << "ABC" << n <<endl;
	
	return 0;
}


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

using namespace std;

int main() {
    int l;
    cin >> l;
    int r;
    cin >> r;
    int d;
    cin >> d;
    int output = 0;
    for (int i = l; i <= r; i++){
        if (i % d == 0){
            output++;
        }
    }
    cout << output;
	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void){
  char s[3], t[3];
  scanf("%c%c%c\n%c%c%c",&s[0], &s[1], &s[2], &t[0], &t[1], &t[2]);
  int ans=0;
  for(int i=0;i<3;i++){
    if(s[i]==t[i])	ans++;
  }
  printf("%d", ans);
}

Measured memory_bytes: 128
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;

///aとbの最大公約数を求める関数。計算量はO(log min(a, b))
Int Gcd(Int a, Int b) {
	if (a % b == 0)return b;
	else return Gcd(b, a % b);
}

void calc() {

	double pi = 3.1415;
	Int R; std::cin >> R;
	std::cout << std::setprecision(10) << pi * (double)(2 * R);

}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 3748
#include<stdio.h>


int main(){

  int p, c, b, e, h, g, i, sc;

  scanf("%d %d %d %d %d %d", &p, &c, &b, &e, &h, &g);

  for(i=0;i<100;i++){

    if(i == p){

      sc = c + b + e;

      break;

    }else if(i == c){

      sc = p + b + e;

      break;

    }else if(i == b){

      sc = p + c + e;

      break;

    }else if(i == e){

      sc = p + c + b;

      break;

    }
  }

  if(h > g)

    printf("%d\n", sc + h);

  else if(h <= g)

    printf("%d\n", sc + g);

  

  return 0;
  
}

Measured memory_bytes: 600
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**15
mod = 10**9+7

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()
def pf(s): return print(s, flush=True)


def main():
    t = [I() for _ in range(4)]


    return min(t[:2]) + min(t[2:])


print(main())




Measured memory_bytes: 5844
#include<iostream>
#include<cstdio>
#include<vector>
#define ll long long 
using namespace std;
int l,r;
ll ans=2019;
int main()
{
	scanf("%d%d",&l,&r);
	if(r-l>2019) printf("0");
	else{
		for(ll i=l;i<=r;i++)
		  for(ll j=i+1;j<=r;j++)
		    ans=min(ans,(ll)i*j%2019);
		printf("%lld",ans);
	}
	return 0;
}

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

int main(){
    int A,B;
    cin >> A >> B;
        if(A%3 == 0) {
           cout << "Possible" << endl;
        }
        else if(B%3 == 0) {
           cout << "Possible" << endl;
        }
        else if((A+B)%3 == 0){
           cout << "Possible" << endl;
        }
   else {
     cout << "Impossible" << endl;
   }
}


Measured memory_bytes: 256
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

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

string s, t;

int main(){
    cout << fixed << setprecision(15);

    cin >> s >> t;
    int n = s.length();
    s = s + s;

    int64 res = 0;

    vector<vector<int> > position(26);
    rep(i, 2*n) {
        position[int(s[i] - 'a')].push_back(i);
    }

    dbg(position['s' - 'a']);

    int pre = -1;
    rep(i, t.length()) {
        if (position[int(t[i] - 'a')].size() == 0) {
            cout << -1 << '\n';
            return 0;
        }
        auto it = upper_bound(all(position[int(t[i] - 'a')]), pre);
        int x = *it;
        debug(x);
        res += x - pre;
        pre = x % n;
        debug(pre); debug(res);
    }
    
    cout << res << '\n';

    return 0;
}



Measured memory_bytes: 1784
#include <stdio.h>
#include <stdlib.h>

int main(){
    int n, total = 0, pos_inicial, pos_final;
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d %d", &pos_inicial, &pos_final);
        if (pos_inicial == pos_final)
            total += 1;
        else
            total += abs(pos_final - pos_inicial) + 1;
    }
    printf("%d\n", total);
    return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int k,x; cin >> k >> x;
    string ans;
    
    if(k*500 >= x) ans = "Yes";
    else ans = "No";

    cout << ans << ln;
    return 0;
}

Measured memory_bytes: 256