akhauriyash/Code-Regression huggingface dataset:
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 10000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
//bitset<maxx/2>vis;
//bitset<maxx>pr;
//int mobi[maxx+10];
//vector<ll>prime;
//void sieve(){
//    ll x=maxx/2, y=sqrt(maxx)/2;
//    for(ll i=1;i<=y;i++){
//        if(vis[i]==0){
//            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
//                vis[j]=1;
//        }
//    }
//    prime.push_back(2);
//    for(ll i=3;i<maxx;i+=2)
//        if(vis[i/2]==0)
//        prime.push_back(i);
//}
//void generate_mobius()
//{
//    for(int i=0;i<maxx;i++)mobi[i]=1;
//    for(int i=2;i<maxx;i++){
//        if(!pr[i]){
//            mobi[i]*=-1;
//            for(int j=i+i;j<maxx;j+=i){
//                pr[j]=1;
//                mobi[j]*=(j%(i*i)?-1:0);
//            }
//        }
//    }
//}
//bool isprime(ll a)
//{
//    if(a==1)return false;
//    if(a==2)return true;
//    if(a%2==0)return false;
//    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++)
//        if(a%prime[i]==0)return false;
//    return true;
//}
/* Calculate ( a*b ) %c */
inline ll mulmod(ll a, ll b, ll c) {
    ll ret = 0 , cur = a % c ;
    while(b) { if(b%2) ret=(ret+cur)%c; cur=(cur<<1)%c; b=b>>1; }
    return ret%c;
}
//Calculate (b^p)%m || modular inverse: b^-1 = bigmod(b, m-2, m)
inline ll bigmod(ll b, ll p, ll m){
    ll ret = 1, cur = b % m;
    while(p) { if(p&1) ret=(ret*cur)%m; cur=(cur*cur)%m; p=p>>1; }
    return ret;
}
inline ll modulo(ll a,ll b,ll c) { //Same as big mod, use for numbers over 1e10
    ll ret = 1 , cur = a%c ;
    while(b) { if(b%2) ret=mulmod(ret,cur,c); cur=mulmod(cur,cur,c); b=b>>1; }
    return ret%c ;
}
inline ll power(ll b, ll p){
    ll ret = 1, cur = b;
    while(p) { if(p&1) ret=(ret*cur); cur=(cur*cur); p=p>>1; }
    return ret;
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
void Dufaux()
{
    set<char>st;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        st.insert(s[i]);
    }
    ll m=st.size();
    ll n=s.size();
    if(m==n){
        cout<<"yes"<<endl;
    }
    else{
        cout<<"no"<<endl;
    }
}
int main()
{
    FastIO;
	///sieve();
	///generate_mobius();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






Measured memory_bytes: 3616
MAX = 10 ** 5

N = gets.chomp.to_i
st, sx, sy = 0, 0, 0
result = true

N.times do
  et, ex, ey = gets.chomp.split.map(&:to_i)

  n_steps = (ex - sx).abs + (ey - sy).abs
  time = et - st

  if n_steps > time || (time - n_steps).odd?
    result = false
    break
  end
end

puts result ? 'Yes' : 'No'

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
 
using tpl = tuple<char, int>;
typedef pair<int,int> pii;
typedef long long ll;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

int N;
int A[1010];


ll calc(deque<pii> &dq, vector<int> &step){
    ll sum = 0;
    while(dq.size() > 0){
        if(dq[0].second){
            sum += dq[0].first;
            dq.pop_front();
            break;
            
        }
        else{
            step.push_back(1);
        }
        dq.pop_front();
    }

    while(dq.size() > 0){
        if(dq.size() == 1){
            dq.pop_front();
            step.push_back(2);
        }
        else if(!dq[0].second && dq[1].second){
            sum += dq[1].first;
            dq.pop_front();
            dq.pop_front();
            step.push_back(2);
        }
        else if(dq.size() == 2){
            dq.pop_front();
            dq.pop_front();
            step.push_back(3);
            step.push_back(2);
        }
        else if(dq.size() >= 3){
            if(!dq[0].second && !dq[1].second && !dq[2].second){
                dq.pop_front();
                dq.pop_front();
                step.push_back(3);
            }
        }
    }
    return sum;
}

int main(){

    bool all_neg = true;

    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] > 0) all_neg = false;
    }
    if(all_neg){
        int max_v = -1000000001;
        int idx = -1;
        for(int i = 0; i < N; i++){
            if(A[i] > max_v){
                max_v = A[i];
                idx = i;
            }
        }

        vector<int> step;
        for(int i = N - 1; i > idx; i--){
            step.push_back(i + 1);
        }
        for(int i = 0; i < idx; i++){
            step.push_back(1);
        }

        cout << max_v << endl;
        cout << step.size() << endl;
        for(int a: step){
            cout << a << endl;
        }
        return 0;
    }

    ll sum1 = 0;
    ll sum2 = 0;
    vector<int> step1, step2;

    {
        deque<pii> dq;
        for(int i = 0; i < N; i++){
            bool f = false;
            if(i % 2){
                if(A[i] >= 0){
                    f = true;
                }
            }
            dq.push_back(pii(A[i], f));
        }
        sum1 = calc(dq, step1);
    }
    {
        deque<pii> dq;
        for(int i = 0; i < N; i++){
            bool f = false;
            if(i % 2 == 0){
                if(A[i] >= 0){
                    f = true;
                }
            }
            dq.push_back(pii(A[i], f));
        }
        sum2 = calc(dq, step2);
    }

    if(sum1 > sum2){
        cout << sum1 << endl;
        cout << step1.size() << endl;
        for(int a: step1){
            cout << a << endl;
        }
    }
    else{
        cout << sum2 << endl;
        cout << step2.size() << endl;
        for(int a: step2){
            cout << a << endl;
        }
    }


    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int W, H, i, j;
    while(1){
        scanf("%d %d", &W, &H);
        if(W == 0 && H == 0){
            break;
        }
        for(i = 0; i < W; i++){
            for(j = 0; j < H; j++){
                if(i == 0 || i == W - 1 || j == 0 || j == H -1){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2040
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Sat Dec  8 18:38:17 2018
//
package main

import "fmt"

func main() {
	var R int
	fmt.Scan(&R)

	if R < 1200 {
		fmt.Println("ABC")
	} else if R < 2800 {
		fmt.Println("ARC")
	} else {
		fmt.Println("AGC")
	}
}


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

long long q,h,s,d,n,ans;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>q>>h>>s>>d>>n;
    h=min(h,q*2);
    s=min(s,h*2);
    d=min(d,s*2);
    ///cout<<q<<" "<<h<<" "<<s<<" "<<d<<" "<<n*s<<" "<<n/2*d+(n%2)*s<<" ";
    ans=n*s;
    ans=min(ans,n/2*d+(n%2)*s);
    cout<<ans;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
typedef pair<ll, int> P;
int main() {
	int N, K;
	cin >> N >> K;
	vector<P> sushi;
	for (int i = 0; i < N; i++) {
		int t, d;
		cin >> t >> d;
		sushi.emplace_back(d, t);
	}
	sort(sushi.begin(), sushi.end(), greater<P>());
	set<int> S;
	priority_queue<ll, vector<ll>, greater<ll>> Q;
	ll ans = 0;
	ll sum = 0;
	ll t = 0;
	for (int i = 0; i < K; i++) {
		sum += sushi[i].first;
		if (S.find(sushi[i].second) == S.end()) {
			S.insert(sushi[i].second);
			t++;
		}
		else {
			Q.push(sushi[i].first);
		}
	}
	ans = max(ans, sum + t * t);
	for (int i = K; i < N; i++) {
		if (Q.empty()) break;
		if (S.find(sushi[i].second) == S.end()) {
			t++;
			sum = sum - Q.top() + sushi[i].first;
			ans = max(ans, sum + t * t);
			Q.pop();
			S.insert(sushi[i].second);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 5232
#include<bits/stdc++.h>
using namespace std;
const int N=1e4+5;
int f[N];
int main()
{
    int ans=0;
    int n;scanf("%d",&n);
    for(int i=1;i*i<=n;i++)
        for(int j=1;i*i+j*j<=n;j++)
        for(int k=1;k*k+i*i+j*j<=n;k++)
    {
        int s=i*i+j*j+k*k+i*j+i*k+k*j;
        if(s<=n) f[s]++;
    }
    for(int i=1;i<=n;i++) printf("%d\n",f[i]);
}


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

int main()
{
	int d, n, ans, cnt = 0;
	std::cin >> d >> n;
	int a = pow(100, d);

	for (int i = 0; cnt < n; i++)
	{
		ans = a * i;
		if (i % 100 != 0)
		{
			cnt++;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
#define inf 0x3f3f3f3f
typedef long long ll;
const int maxn=400;
int n,m;
ll mp[maxn][maxn],l;
void init(){
	memset(mp,inf,sizeof(mp));
	for(int i=1;i<=n;i++){
		mp[i][i]=0;
	}
}
int main(){
	scanf("%d%d%lld",&n,&m,&l);
	int a,b,c;
	init();
	for(int i=0;i<m;i++){
		scanf("%d%d%d",&a,&b,&c);
		if(mp[a][b]>c)mp[a][b]=c,mp[b][a]=c;
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(mp[i][j]>mp[i][k]+mp[k][j])
					mp[i][j]=mp[i][k]+mp[k][j];
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(mp[i][j]>l)mp[i][j]=inf;
			else mp[i][j]=1;
		}
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(mp[i][j]>mp[i][k]+mp[k][j])
					mp[i][j]=mp[i][k]+mp[k][j];
			}
		}
	}
	int q;
	scanf("%d",&q);
	while(q--){
		int s,t;
		scanf("%d%d",&s,&t);
		if(mp[s][t]==inf)puts("-1");
		else printf("%lld\n",mp[s][t]-1);
	}
	return 0;
}


Measured memory_bytes: 1792
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

n, k = [int(i) for i in input().split()]
d = []
A = []
for i in range(k):
    d.append(int(input()))
    A.append([int(i) for i in input().split()])

tmp = [True for i in range(n + 1)]
res = 0

for i in range(k):
    for j in range(d[i]):
        tmp[A[i][j]] = False
for i in range(1, n + 1):
    if tmp[i]:
        res += 1

print(res)


Measured memory_bytes: 31092
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7

def sol():
    N = int(input())
    actions = []


    for _ in range(N):
        a, b, c = map(int, input().split())
        actions.append((a, b, c))

    dp = [[0] * 3 for _ in range(N + 1)]  # dp[day][prevAct]

    for day, (a, b, c) in enumerate(actions):
        dp[day + 1][0] = max(dp[day][1], dp[day][2]) + a
        dp[day + 1][1] = max(dp[day][2], dp[day][0]) + b
        dp[day + 1][2] = max(dp[day][0], dp[day][1]) + c

    ans = max(dp[N])
    print(ans)


sol()

Measured memory_bytes: 69980
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> mv;
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		mv.push_back(t);
	}
	if(n%2!=0){
		cout<<0<<endl;
		return 0;
	}
	sort(mv.begin(),mv.end(),less<int>());
	int sz=mv.size();
	cout<<mv[sz/2 ] - mv[sz/2-1]<<endl;
	return 0;
}

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

int main(void){
  int x[101],i=0;
  char s[101];

  while( scanf("%s",s) != EOF ){
    if ( s[0] == '+' ){
    	i--;
    	x[i] = x[i] + x[i+1];

    } else if ( s[0] == '-' ){
    	i--;
    	x[i] = x[i] - x[i+1];

    } else if ( s[0] == '*' ){
    	i--;
    	x[i] = x[i] * x[i+1];

    } else {
    	i++;
      x[i] = atoi(s);

    }
  }
	
	printf("%d\n", x[1]);

  return 0;
}


Measured memory_bytes: 2088
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int x, n, p, dif;
    cin >> x >> n;
    vector<int> forb(102);
    for(int i = 0; i < n; ++i){
        cin >> p;
        forb.at(p) = 1;
    }
    pair<int, int> ans(999, -1);
    for(int i = 0; i < 102; ++i){
        if(forb.at(i) == 1) continue;
        else{
            dif = abs(x - i);
            pair<int, int> p(dif, i);
            ans = min(ans, p);
        }
    }
    cout << ans.second << endl;
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	lint N, x;
	cin >> N >> x;

	vector<lint> a(N);
	for (int i = 0; i < N; i++) cin >> a[i];

	lint ans = 0;
	for (int i = 0; i < N - 1; i++) {
		
		if (x - a[i] < 0) {
			ans += a[i + 1] + (a[i] - x);
			a[i + 1] = 0;
		}
		else if (a[i + 1] + (a[i] - x) > 0) {
			ans += a[i + 1] + (a[i] - x);
			a[i + 1] -= a[i + 1] + (a[i] - x);
		}

	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 1024
using System;

namespace ABC157A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            a = int.Parse(Console.ReadLine());
            if (a % 2 == 0)
                Console.WriteLine(a / 2);
            else
                Console.WriteLine(a / 2 + 1);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

int main () {
    double a, b, x, y;
    int C;
    cin >> a >> b >> C;
    x = cos(M_PI*C/180)*b*tan(M_PI*C/180);
    y = a-cos(M_PI*C/180)*b;
    printf("%.8f %.8f %.8f\n", sin(M_PI*C/180)*a*b/2, a+b+hypot(x,y) , x);
}

Measured memory_bytes: 1348
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
const int INF = (1LL<<30);
const ll LLINF = (1LL<<60);
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;
//#define int ll

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

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

string s[105];
int cnt[30];
signed main(void)
{
  int h, w;
  cin >> h >> w;
  REP(i, h) cin >> s[i];

  REP(i, h) REP(j, w) cnt[s[i][j]-'a']++;

  int yon = (h/2)*(w/2);
  int ni = 0;
  if(h%2) ni += w/2;
  if(w%2) ni += h/2;
  int iti = 0;
  if(h%2 && w%2) iti = 1;

  int idx = 0;
  while(yon) {
    if(cnt[idx] >= 4) cnt[idx] -= 4, yon--;
    if(cnt[idx] < 4) idx++;
    if(idx == 26) break;
  }
  idx = 0;
  while(ni) {
    if(cnt[idx] >= 2) cnt[idx] -= 2, ni--;
    if(cnt[idx] < 2) idx++;
    if(idx == 26) break;
  }
  idx = 0;
  while(iti) {
    if(cnt[idx] >= 1) cnt[idx]--, iti--;
    if(cnt[idx] < 1) idx++;
    if(idx == 26) break;
  }

  bool flag = true;
  REP(i, 26) if(cnt[i]) flag = false;
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
// Ho-kago Tea Time

#include <bits/stdc++.h>

using namespace std;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getchar());
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

typedef long long LL;
typedef pair<int, int> pii;

LL N;

inline void input()
{
	N = read<LL>();
}

inline void solve()
{
	int p = 50;
	while(N < (1ll << p) - 1) --p;

	static int cnt[50];

	N -= (1ll << p) - 1;
	for(int q = p; N > 0; )
	{
		while(N < (1ll << q)) --q;
		N -= (1ll << q);
		++cnt[q + 1];
	}

	static vector<int> ans, seq;

	int M = p;
	for(int i = 1; i <= p + 1; ++i)
	{
		while(cnt[i]--)
		{
			ans.push_back(++M);
			seq.push_back(M);
		}
		if(i <= p) ans.push_back(i);
	}
	for(int i = 1; i <= p; ++i) ans.push_back(i);

	reverse(ALL(seq));
	for(auto i : seq) ans.push_back(i);

	printf("%d\n", SZ(ans));
	for(auto i : ans) printf("%d ", i);
	puts("");
}

int main()
{
#ifdef K_ON // K-ON!
	freopen("C.in", "r", stdin);
	freopen("C.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

const long double EPS = 1e-9;

bool eq(long double a, long double b)
{
	return (fabs(b - a) <= EPS);
}

struct two {
	long double a, p, q;
	two(long double a, long double p, long double q) : a(a), p(p), q(q) {}
};

struct Point {
	long double x, y;
	Point(long double x, long double y) : x(x), y(y) {}
};

bool operator < (const Point &a, const Point &b)
{
	return (a.x < b.x);
}

vector<Point> get(two u, two v)
{
	vector<Point> ret;
	long double a = u.a - v.a,
			b = -2 * u.a * u.p - (-2 * v.a * v.p),
			c = (u.a * u.p * u.p + u.q) - (v.a * v.p * v.p + v.q);
	
	if (eq(a, 0)){
		if (!eq(b, 0)){
			long double x = -c / b;
			Point p(x, v.a * (x - v.p) * (x - v.p) + v.q);
			ret.push_back(p);
		}
	}
	else {
		long double D = b * b - 4 * a * c;
		
		if (D + EPS >= 0){
			if (eq(D, 0)){
				long double x = -b / (2 * a);
				ret.push_back(Point(x, v.a * (x - v.p) * (x - v.p) + v.q));
			}
			else {
				long double x1 = (-b + sqrt(D)) / (2 * a),
							 x2 = (-b - sqrt(D)) / (2 * a);
				ret.push_back(Point(x1, v.a * (x1 - v.p) * (x1 - v.p) + v.q));
				ret.push_back(Point(x2, v.a * (x2 - v.p) * (x2 - v.p) + v.q));
			}
		}
	}
	
	return (ret);	
}

long double integral(two t, long double x)
{
	long double u = 2 * t.a * (x - t.p);
	return ((log(fabs(u + sqrt(1 + u * u))) + u * sqrt(1 + u * u)) / (4 * t.a));
}

int main()
{
	int W, H, N;
	vector<two> v;
	vector<Point> pt;
	
	scanf("%d %d %d", &W, &H, &N);
	
	for (int i = 0; i < N; i++){
		int a, p, q;
		scanf("%d %d %d", &a, &p, &q);
		v.push_back(two(a, p, q));
	}
	
	for (int i = 0; i < N; i++){
		for (int j = i + 1; j < N; j++){
			vector<Point> a = get(v[i], v[j]);
			for (int s = 0; s < a.size(); s++){
				pt.push_back(a[s]);
			}
		}
		pt.push_back(Point(0, v[i].a * v[i].p * v[i].p + v[i].q));
		pt.push_back(Point(W, v[i].a * (W - v[i].p) * (W - v[i].p) + v[i].q));
		vector<Point> a = get(v[i], two(0, 0, 0));
		for (int s = 0; s < a.size(); s++)
			pt.push_back(a[s]);
	}
	
	sort(pt.begin(), pt.end());
	long double len = 0.0;
	for (int i = 0; i < (int)pt.size() - 1; i++){
		if (0 <= pt[i].x + EPS && pt[i + 1].x - EPS <= W && !eq(pt[i].x, pt[i + 1].x)){
			int cand = -1;
			long double val = -1e20;
			long double piv = (pt[i].x + pt[i + 1].x) / 2.0;
			for (int j = 0; j < N; j++){
				if (v[j].a * (piv - v[j].p) * (piv - v[j].p) + v[j].q > val){
					cand = j;
					val = v[j].a * (piv - v[j].p) * (piv - v[j].p) + v[j].q;
				}
			}
			if (0 <= val + EPS){
				//printf("%Lf %Lf %d\n", pt[i].x, pt[i + 1].x, cand);
				//printf("%Lf %Lf\n", integral(v[cand], pt[i + 1].x), integral(v[cand], pt[i].x));
				len += fabs(integral(v[cand], pt[i + 1].x) - integral(v[cand], pt[i].x));
			}
		}
	}
	
	printf("%.15Lf\n", len);
	
	return (0);
}

Measured memory_bytes: 1268
// https://atcoder.jp/contests/abc094/tasks/arc095_b

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 1e5;
const int A_I_MAX = 1e9;

int n;
int a[N_MAX];

void solve() {
  sort(a, a + n, greater<int>());
  int m = a[0];
  int k = -1;
  int v = -1;
  FOR(i, 1, n - 1) {
    int v2 = min(m - a[i], a[i]);
    if (v2 > v) {
      k = a[i];
      v = v2;
    }
  }
  printf("%d %d\n", m, k);
}

void input() {
  scanf("%d", &n);
  REP(i, n) scanf("%d", a + i);
}

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


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>

#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INPUT1(n, a) for(int i##n = 0; i##n < n; i##n++) {cin >> a[i##n]; } //n = count, a = vector 
#define OUTPUT1(n, a) cout << "---count---" << endl << n << endl << "---content---" << endl; for(const auto b : a){cout << b << endl; }
#define INPUT2(x, y, field) for(int i##x = 0; i##x < y; i##x++) { for(int j##x = 0; j##x < x; j##x++) { cin >> field[i##x][j##x]; } }
#define OUTPUT2(x, y, field) cout << "---count---" << endl << x << " " << y << endl <<"---content---" << endl; for(int i##x = 0; i##x < y; i##x++) { cout << i##x << "   "; for(int j##x = 0; j##x < x; j##x++) { cout << field[i##x][j##x] << " "; } cout << endl; }

using namespace std;
using ll = long long;

const int INF = 1001001001;

int main()
{
	ll h, n, s, sum;
	cin>>h>>n;
	
	rep(i,n){
	    cin>>s;
	    sum+=s;
	}
	if(sum>=h)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int D, W, e;
int A[11][11];
int a[11][11];
int S[11][11];
int s[11][11];

int menseki (int lx, int ly, int rx, int ry) {
	int R = s[ry][rx] - s[ly - 1][rx] - s[ry][lx - 1] + s[ly - 1][lx - 1];
	return R;
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    


int solve() {
	int ans = 0;
	for (int d = 0; d <= D; d++) {
		for (int w = 0; w <= W; w++) {
			if (d * w == 0) {
				S[d][w] = 0;
				continue;
			}
			cin >> e;
			A[d][w] = e;
			S[d][w] = e + S[d - 1][w] + S[d][w - 1] - S[d - 1][w - 1];
			
		}
	}
	
	
	for (int v = 1; v <= 9; v++) {
		for (int d = 0; d <= D; d++) {
			for (int w = 0; w <= W; w++) {
				if (d * w == 0) {
					s[d][w] = 0;
					continue;
				}
				
				if (v > A[d][w]) {
					a[d][w] = 1;
					s[d][w] = 1 + s[d - 1][w] + s[d][w - 1] - s[d - 1][w - 1];
				} else {
					a[d][w] = 0;
					s[d][w] = 0 + s[d - 1][w] + s[d][w - 1] - s[d - 1][w - 1];
				}
			}
		}
		/*cout << "v" << v;
		for (int d = 0; d <= D; d++) {
			for (int w = 0; w <= W; w++) {
				cout << s[d][w] << " ";
			}
			cout << endl;
		}
		*/
		for (int lx = 2; lx < W ; lx++) {
			for (int by = 2; by < D ; by++) {
				for (int rx = lx; rx < W ; rx ++) {
					for (int ty = by; ty < D ; ty++) {
						if (menseki(lx, by, rx, ty) == (rx - lx + 1) * (ty - by + 1) and
							menseki(lx - 1, by - 1, rx + 1, ty + 1) == (rx - lx + 1) * (ty -by + 1)) {
								ans = max(ans, v * (rx - lx + 1) * (ty - by + 1) - (S[ty][rx] - S[by - 1][rx] - S[ty][lx - 1] + S[by - 1][lx - 1]));
						}
					}
				}
			}
		}
	}
	cout << ans << endl;
}


int main() {
	cin >> D >> W;
	while (D > 0 and W > 0) {
		solve();
		cin >> D >> W;
	}
}
	
	


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

#define sysp system("pause")

typedef long long ll;

int n;
long long ans,fac;
vector<int> pl;

int main(){
	cin>>n;
	ans=1;
	pl.push_back(2);
	//if(n==3)pl.push_back(3);
	for(int i=3;i<=n;i+=2){
		int k=0;
		for(int j=3;j<=sqrt(i);j+=2){
			if(i%j==0){
				k=1;
				break;
			}
			
		}
		if(k==0)pl.push_back(i);
	}
	for(int i=0;i<pl.size();i++){
		int j=pl[i];
		for(;j<=n;j*=pl[i]){
			fac+=n/j;
		}
		ans*=fac+1;
		ans%=1000000007;
		fac=0;
	}
	cout<<ans<<endl;
	sysp;
} 

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
int n,k;
map<int,int>mp;
const int p = 1000000007;
int pw(int x,int y)
{
    int lst=1;
    while(y)
    {
        if(y&1)lst=1LL*lst*x%p;
        y>>=1;
        x=1LL*x*x%p;
    }
    return lst;
}
int yin[100005],cnt;
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            yin[++cnt]=i;
            if(i*i!=n)yin[++cnt]=n/i;
        }
    }
    int ans=0;
    sort(yin+1,yin+cnt+1);
    for(int i=1;i<=cnt;i++)
    {
        int tmp=pw(k,(yin[i]-1)/2+1);
        if(i!=1)
        for(int j=1;j*j<=yin[i];j++)
        {
            if(yin[i]%j==0)
            {
                tmp-=mp[j];
                if(j*j!=yin[i]&&j!=1)tmp-=mp[yin[i]/j];
                tmp=(tmp%p+p)%p;
            }
        }
        mp[yin[i]]=tmp;
        if(yin[i]%2==1)ans+=1LL*tmp*yin[i]%p;
        else ans+=1LL*tmp*yin[i]%p*500000004%p;
        ans%=p;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int x, y;
  cin >> x >> y;
  int ans = 0;
  for (int i : {x,y}) {
    if (i <= 3) ans += (4-i)*1e5;
  }
  if (x == 1 && y == 1) ans += 4e5;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <list>
#include <bitset>
using namespace std;


#define MAX 500000
#define SENTINEL 2000000000
#define INFTY (1<<21)
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2

template <class T> inline bool chmin(T& a, T b){
  if (a > b){
    a = b;
    return true;
  }
  return false;
}

template <class T> inline bool chmax(T& a, T b){
  if (a < b){
    a = b;
    return true;
  }
  return false;
}


int main(){
  int n;
  cin >> n;
  int A[n];
  int DP[n];
  for (int i=0; i<n; i++){
    cin >> A[i];
  }
  for (int i=0; i<n; i++){
    if (i==0){
      DP[i] = 0;
    } else if (i == 1) {
      DP[i] = abs(A[i] - A[i-1]);
    } else {
      DP[i] = min(abs(A[i]-A[i-1])+DP[i-1], abs(A[i]-A[i-2])+DP[i-2]);
    }
  }
 
  cout << DP[n-1] << endl;
 
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N,sum=0;
	cin>>N;
	if(N>=0&&N<10)
	sum=N;
	else if(N>=10&&N<100)
	sum=9;
	else if(N>=100&&N<1000)
	sum=N-90;
	else if(N>=1000&&N<10000)
	sum=909;
	else if(N>=10000&&N<100000)
	sum=N-9090;
	else if(N=100000)
	sum=90909;
	cout<<sum<<endl;
	return 0;
	
	
}

Measured memory_bytes: 256
N,P=map(int,input().split())
l=[]
pf={}
m=P
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
keys=list(pf.keys())
val=list(pf.values())
ans=1
for i in range(len(keys)):
    l.append([keys[i],val[i]])
#print(l)
for i in range(len(l)):
    if l[i][1]>=N:
        ans=ans*pow(l[i][0],l[i][1]//N)
print(ans)

Measured memory_bytes: 40172
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

		int N = sc.nextInt();
		String S = sc.next();
		
		String Ss[] = S.split("");
		int max = 0;

		for (int i = 0; i < N; i++){
			
			Set<String> tmpA = new HashSet<String>();
			Set<String> tmpB = new HashSet<String>();
			
			for (int j = 0; j < i; j++) {
				tmpA.add(Ss[j]);
			}
			
			for (int j = i; j < N; j++) {
				tmpB.add(Ss[j]);
			}
			
			tmpA.retainAll(tmpB);
			
			if (max < tmpA.size()) {
				max = tmpA.size();
			}

		}

		System.out.println(max);

	}
}

Measured memory_bytes: 23636
#include<iostream>
#define ll long long
using namespace std;
ll a,b,c,d;
int main(){
    cin>>a>>b>>c>>d;
    ll t1=a*c,t2=a*d,t3=b*c,t4=b*d;
    cout<<max(max(t1,t2),max(t3,t4))<<endl;
    return 0;
}


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

using namespace std;


using int64 = long long;
const int64 INF = 1LL << 60;


int main() {
  int N, K, A[100000];
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  vector< int64 > dp(N, INF);
  dp[0] = 0;
  for(int i = 1; i < N; i++) {
    for(int j = 1; j <= 2; j++) {
      if(i - j >= 0) {
        dp[i] = min(dp[i], dp[i - j] + abs(A[i] - A[i - j]));
      }
    }
  }
  cout << dp.back() << endl;
}


Measured memory_bytes: 1408
/*
 * Created by Dipta Das on 08-05-2019
 * Title: 
 * Problem Link: 
 * Editorial: 
 * Source Code: 
 * Comments: 
*/

#include <bits/stdc++.h>
#include <stdio.h>
#define fin freopen("input", "r", stdin)
#define whatis(x) cerr << #x << ": " << x << endl;

using namespace std;
using ll = long long;

const int INF = 1e9 + 5;

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

    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (auto &i : h) cin >> i;
    vector<int> dp(n, INF);

    dp[0] = 0;

    for (int i = 0; i < n; ++i) {
        for (int j = 1; j <= k; ++j) {
            if (i + j < n) {
                dp[i+j] = min (dp[j+i], dp[i] + abs(h[i] - h[i+j]));
            }
        }
    }
    
    cout << dp[n-1] << endl;


    return 0;
}



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

int main(void){
    int n;
    cin >> n;
    int a, min = 1e9;
    for(int i=0; i<n; i++){
        cin >> a;
        int cnt = 0;
        while(a%2 == 0){
            a /= 2;
            cnt++;
        }
        if(cnt < min){
            min = cnt;
        }
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
fn main() {
  let n = get::chars();
  let ans = if n[0]==n[1]&&n[1]==n[2] || n[1]==n[2]&&n[2]==n[3] {"Yes"} else {"No"};
  println!("{}", ans)
}


#[allow(dead_code)]
mod get {
  use std::io::*;
  use std::str::*;

  pub fn val<T: FromStr>() -> T {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().parse::<T>().ok().unwrap()
  }

  pub fn vals<T: FromStr>(n: usize) -> Vec<T> {
    let mut vec: Vec<T> = vec![];
    for _ in 0 .. n {
      vec.push(val());
    }
    vec
  }

  pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    (x, y)
  }

  pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> {
    let mut vec: Vec<(T1, T2)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple());
    }
    vec
  }

  pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    let z = it.next().unwrap().parse::<T3>().ok().unwrap();
    (x, y, z)
  }

  pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> {
    let mut vec: Vec<(T1, T2, T3)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple3());
    }
    vec
  }

  pub fn list<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
  }

  pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> {
    let mut mat: Vec<Vec<T>> = vec![];
    for _ in 0 .. h {
      mat.push(list());
    }
    mat
  }

  pub fn chars() -> Vec<char> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().chars().collect()
  }
}


Measured memory_bytes: 4352
#include <stdio.h>
int main()
{
    char a[11]={0};
    scanf("%s",a);
    if(a[0]=='Y' && a[1]=='A' && a[2]=='K' && a[3]=='I')
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}

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

N = int(input())
# X, Y = map(int,input().split())
# Z, W = map(int,input().split())
# vA = list(map(int, input().split()))

for x in range(N+1):
    if int(x * 1.08) == N:
        print(x)
        exit(0)
print(":(")


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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sax(x) cout << "!!!!!!!!!!! " << #x << " = " << x << '\n'
#define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18)
#define one(x) x.insert(x.begin(), 0);
#define TCT template <class T>
#define TCT12 template <class T1, class T2>
#define IS istream
#define OS ostream
#define OP operator

//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//tree_order_statistics_node_update> imsi;

TCT IS& OP>>(IS &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
TCT OS& OP<<(OS &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; /*O << '\n';*/ return O;}
TCT OS& OP<<(OS &O, const unordered_set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const unordered_multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, const multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT IS& OP>>(IS &I, deque<T>& v) {for (T &e: v) I >> e; return I;}
TCT OS& OP<<(OS &O, const deque<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT OS& OP<<(OS &O, priority_queue<T> v) {while (!v.empty()) {O << v.top() << ' '; v.pop();} return O;}
TCT OS& OP<<(OS &O, stack<T> v) {while (!v.empty()) {O << v.top() << '\n'; v.pop();} return O;}
TCT OS& OP<<(OS &O, queue<T> v) {while (!v.empty()) {O << v.front() << ' '; v.pop();} return O;}
TCT12 IS& OP>>(IS &I, pair<T1,T2>& p) {return I >> p.first >> p.second;}
TCT12 OS& OP<<(OS &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
TCT12 OS& OP<<(OS &O, const unordered_map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT12 OS& OP<<(OS &O, const map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
typedef pair<int,int> pii;
typedef vector<int> vi;




void _main() {
        int n; cin >> n;
        cout << n * n * n;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x,n;cin>>x>>n;
    vector<bool> used(102,false);//0-101
    rep(i,n){
        ll p; cin>>p;
        used[p]=true;
    }
    ll a = x, b = x;
    while(used[a])a--;
    while(used[b])b++;
    if(b-x<x-a)cout<<b<<endl;
    else cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll n,x;
  cin >> n >> x;
  vl m(n);
  rep(i,n){
    cin >> m[i];
    x-=m[i];
  }
  ll cnt=n;
  sort(m.begin(),m.end());
  cnt+=x/m[0];
  cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int a=scan.nextInt();
        int b=scan.nextInt();
        int r;
        while(a%b!=0){
            r=a%b;
            a=b;
            b=r;
        }
        System.out.println(b);
    }
}


Measured memory_bytes: 26156
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <stdio.h>
using namespace std;
using ll =long long;

int main (void) {
  int N,M,K;
  cin >> N >> M >>K;
  for(int n=0;n<=M;n++){
    for(int m=0;m<=N;m++){
      if(n*(N-m)+m*(M-n)== K){
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";
}


Measured memory_bytes: 256
k, n, *a = map(int, open(0).read().split())

dis_max = 0

for i in range(1, len(a)):
  dis_i = a[i] - a[i-1]
  if dis_i > dis_max:
    dis_max = dis_i

if (k-a[-1]+a[0]) > dis_max:
  dis_max = (k-a[-1]+a[0])

ans = k - dis_max

print(ans)

Measured memory_bytes: 91692
n = int(input())
s = list(input())

a = s.count('R')
b = s.count('G')
c = s.count('B')

ans = a * b * c

m = (n-1) // 2
ans = a * b * c
for d in range(1, n):
    if d * 2 >= n:
        break
    for i in range(n):
        if i + d * 2 >= n:
            break
        if s[i] != s[i+d] and s[i] != s[i+d*2] and s[i+d] != s[i+d*2]:
            ans -= 1

print(ans)

Measured memory_bytes: 73732
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
signed main()
{
    SPEED;
    string str;
    cin>>str;
    int n=str.size(),c=0;
    if(n%2==0)
    {
        for(int i=0;i<n/2;i++)
        {
            if(str[i]!=str[n-1-i])
            {
                c++;
            }
        }
    }
    else
    {
        for(int i=0;i<n/2;i++)
        {
            if(str[i]!=str[n-1-i])
            {
                c++;
            }
        }
    }
    cout<<c;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
using namespace std;

#define ll long long int
#define ld long double
#define reps(i,f,n) for(int i=f;i<n;i++)
#define rep(i,n) reps(i,0,n)
#define m1 cout<<"move1"<<endl
#define m2 cout<<"move2"<<endl
#define m3 cout<<"move3"<<endl
#define m4 cout<<"move4"<<endl


int main(){
  ll m,N_max,N_min;
  ll sa = 0;
  ll sa_max = 0;
  ll ans = 0;
  ll v[1000];

  while(cin>>m>>N_min>>N_max,m,N_min,N_max){
    sa = 0;
    sa_max = 0;
    ans = 0;
    rep(i,m)cin>>v[i];
  
    // m2;
    reps(i,N_min,N_max+1){
      sa = v[i-1] - v[i];
      //cout<<sa<<endl;
      //m1;
      if( sa_max <= sa){
	sa_max = sa;
	ans = i;
	//cout<<"#"<<ans<<endl;
      }
    }
    cout<<ans<<endl;
  }

  return 0;
}

Measured memory_bytes: 3076
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;

const int MX = 100005;

ll gcd(ll x,ll y) {return y?gcd(y,x%y):x;}

int main() {
  ll n, x;
  cin >> n >> x;
  ll ans = (n-gcd(n,x))*3;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <math.h>
#include <deque>
#include <stack>
#include <queue>

#define PI 3.14159265358979323846

using namespace std;

typedef long long ll;
typedef long double ld;


int solve() {
    ll a, b;
    cin >> a >> b;
    if (a >= 1 && a <= 9 && b >= 1 && b <= 9){
        cout << a * b << endl;
    }else{
        cout << -1 << endl;
    }
  return 0;
}


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


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.range;

void main(){
	// input
	int[] input;
	input.length = 4;

	foreach(ref i; input) {
		i = to!int(readln().chomp());
	}

	immutable int five_hund = input[0];
	immutable int hund = input[1];
	immutable int fifty = input[2];
	immutable int sum_num = input[3];

	writeln(get_all_paterns(five_hund, hund, fifty, sum_num));


}

int get_all_paterns(int five_hund, int hund, int fifty, int sum_num){
	int result;

	foreach(fh_num; iota(0,five_hund+1)) {
		foreach(h_num; iota(0, hund+1)) {
			foreach(f_num; iota(0, fifty+1)) {
				if(500 * fh_num + 100 * h_num + 50 * f_num == sum_num){
					result++;
				}
			}
		}
	}

	return result;	
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

bool dp[100010];
 
int main(){
	int N,K; cin >> N >> K;
	vector<int> a(N);
	rep(i,N) cin >> a[i];
	rep(i,K+1) dp[i] = false;
	rep(i,K+1){
		rep(j,N){
			if(i-a[j] >= 0){
				if(dp[i-a[j]] == false) dp[i] = true;
			}
		}
	}
	cout << (dp[K] ? "First" : "Second") << endl;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std ;
#define gc getchar
#define ll long long
#define inf 1000009
typedef long long LL;
 LL gcd(LL a, LL b) { return (b == 0 ? a : gcd(b, a % b)); }
 LL Lcm(LL a, LL b) { return (a * (b / gcd(a, b))); }
LL isPrime(LL x)  { ll s = sqrt(x); for (ll i = 2; i <= s; i++) if (x % i == 0) return 0; return 1;} 
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    string s;
    scanf("%d", &N);
    cin>>s;
    ll red, green, blue, result;
    red = green = blue = 0;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == 'R')
            red++;
        if(s[i] == 'G')
            green++;
        if(s[i] == 'B')
            blue++;
    }
    result = red * green * blue;
    for(int i=1;i<=N;i++)
    {
    	
    	for(int j=0;j<s.length();j++)
    	{
    		if(j+i<N && i*2+j<N)
    		{
    		if(s[j]!=s[j+i]  && s[j+i]!=s[i*2+j]  && s[i*2+j]!=s[j])
    		result--;
    		}
    	}
    	
    	
    }
    cout<<result<<endl;
}
    

	

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

#define fastio 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ld long double
#define forn(low,high,i) for(i = low; i < high; i++)
#define forrev(high,low,i) for(i = high; i >= low; i--)
#define all(v) v.begin(),v.end()
#define decimal_digits cout << fixed << setprecision(15);

string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int inf = 1e9;
const long long INF = 1e18;
const int mod = 1e9 + 7;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

inline int add(long long a, long long b){a += b; if(a >= mod) a -= mod; return a;}
inline int sub(long long a, long long b){a -= b; if(a < 0) a += mod; return a;}
inline int mul(long long a, long long b){a %= mod; b %= mod; return (int)((long long) a * b % mod);}
inline int modexpo(long long a, long long b){int res = 1; while(b > 0){ if(b & 1) res = mul(res, a); a = mul(a, a); b /= 2;} return res;}
inline int divide(long long a, long long b){return mul(a, modexpo(b, mod - 2));}
inline int inv(long long a){return modexpo(a, mod - 2);}

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

void pre(){ // Reset each global variable (esp. for graphs)
  
}

const int N = 3000;
long double p[N];
long double cc[N][N];
bool vis[N][N];

long double dp(int idx, int left){
  if(idx < 0){
    return left == 0;
  }
  if(left < 0)
    return 0;
  long double &ans = cc[idx][left];
  if(vis[idx][left])
    return ans;
  vis[idx][left] = 1;
  ans = 0.0;
  ans += p[idx] * dp(idx - 1, left - 1);
  ans += (1 - p[idx]) * dp(idx - 1, left);
  return ans;
}

void solve(){
  int n; cin >> n;
  for(int i = 0; i < n; i++){
    cin >> p[i];
  }
  long double ans = 0.0;
  for(int i = (n + 1) / 2; i <= n; i++){
    ans += dp(n - 1, i);
  }
  decimal_digits;
  cout << ans << '\n';
}

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

  pre();

  int t = 1;
  // cin >> t;
  while(t--){
    solve();
  }

  ktj();
}


Measured memory_bytes: 149120
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

x=input().rstrip()
fx=sum(map(int,list(str(x))))
#print(fx)
if int(x) % fx ==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3316