akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
 
struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is,pair<T1,T2>&p){
    is>>p.first>>p.second;
    return is;
}

template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

int n,m;

void solve(){
    vector<ll> s(n);
    cin>>s;

    // tの時，いけるか，
    auto f=[&](ll x){
        // cout<<x<<" ikuyo"<<endl;
        ll c=0;
        ll lv=1;

        // 少なくとも1匹目は殺せるような範囲で二分法してるので
        // このwhileはいずれ止まるはず
        while(!(s.back()<lv+x)){
            // cout<<c<<" : "<<lv<<endl;
            // min(|lv-si|) , si<lv+xとなるようなsiを倒し，lv up
            auto right=lower_bound(ALL(s),lv+x)-begin(s);
            // [0,right)まで倒せる

            auto ite=lower_bound(begin(s),begin(s)+right,lv);
            ll t=LINF;
            if(ite!=begin(s)+right)chmin(t,abs(lv-*ite));
            if(ite!=begin(s)) chmin(t,abs(lv-*prev(ite)));
            lv+=max(1ll,x-t);
            c++;
        }
        // ここで最後の敵を倒す
        c++;
        return c>=m;
    };

    ll lw=s[0],hi=INF,res=-1;
    while(lw<=hi){
        ll mid=(lw+hi)/2;
        if(f(mid)){
            res=mid;
            lw=mid+1;
        }else{
            hi=mid-1;
        }
    }
    cout<<res<<endl;
}

signed main(){
    while(cin>>n>>m,n) solve();
    return 0;
}



Measured memory_bytes: 3884
n,k = gets.chomp.split(" ").map(&:to_i);
h = gets.chomp.split(" ").map(&:to_i);
 
h = h.sort.reverse
k.times{
h.shift
 }

len = h.length
if len != 0
  puts h.inject(:+)
else
  puts 0
end

Measured memory_bytes: 21360
n, m = map(int, input().split())
h = list(map(int,input().split()))
ans = [1]*n
for j in range(m):
    a, b = map(int, input().split())
    if h[a-1] <= h[b-1]:
        ans[a-1] *= 0
    if h[b-1] <= h[a-1]:
        ans[b-1] *= 0
print(sum(ans))

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

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string S; cin >> S;
	int n = (int)S.length();

	bool res = true;
	int cnt1 = 0;
	for (int i = 2; i < n - 1; ++i){
		if (S[i] == 'C') ++cnt1;
	} // end rep

	int cnt2 = 0;
	rep (i, 2){
		cnt2 += (int)(S[i] == 'C');
	} // end rep	
	cnt2 += (int)(S[n-1] == 'C');

	bool Omoji = true;
	rep (i, n){
		if (S[i] == 'A' || S[i] == 'C') continue;
		if (islower(S[i])) continue;
		Omoji = false;
	} // end rep

	res &= Omoji;
	res &= (S[0] == 'A' && cnt1 == 1 && cnt2 == 0);

	cout << (res ? "AC" : "WA") << endl;

	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
b = [True] * n
for i in range(m):
    x = int(input())
    b[x-1] = False

dp = [0] * n
if(n == 1):
    print(1)
    exit()
if(b[0]):
    dp[0] = 1
    if(b[1]):dp[1] = 2
else:
    if(b[1]):dp[1] = 1

for i in range(2,n):
    if(b[i]):
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
print(dp[-1])

Measured memory_bytes: 7668
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  ll x; cin >> x; ll ans = 0;
  for(ll i=0; i < 1000001; i++){
    if(x <= i*(i+1)/2 ){
      ans = i;
      break;
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto S = sread();
    long ans = long.max;
    {
        char prev = S[0];
        long cnt;
        foreach (i; 0 .. S.length)
            if (S[i] != prev)
            {
                prev = S[i];
                cnt++;
            }
        ans = ans.min(cnt);
    }
    {
        char prev = S[$ - 1];
        long cnt;
        foreach_reverse (i; 0 .. S.length)
            if (S[i] != prev)
            {
                prev = S[i];
                cnt++;
            }
        ans = ans.min(cnt);
    }
    writeln(ans);
}


Measured memory_bytes: 508
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pii pair<int,int>
#define pb push_back
#define pf push_front
#define cases int tc;cin>>tc;while(tc--)
#define N 100003
#define M 103
#define inf LLONG_MAX
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//int mod=1e9+7;
//int mod=998244353;
int dp[M][N];

signed main()
{
    SPEED

    memset(dp,0,sizeof dp);
    int n,W;
    cin>>n>>W;
    int w[n+1],v[n+1],i,j,ans=0;
    for(i=1;i<=n;++i)
        cin>>w[i]>>v[i];

    for(i=1;i<=n;++i)
    {
        ans=0;
        for(j=1;j<=W;++j)
        {
            if(j>=w[i])
                dp[i][j]=max(dp[i][j],dp[i-1][j-w[i]]+v[i]);
            dp[i][j]=max(dp[i][j],dp[i-1][j]);
            ans=max(ans,dp[i][j]);
        }
    }
    cout<<ans;




    return 0;
}


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

using namespace std;

static bool is_prime (
    long long num)
{
    if ( num < 2 )
        return false;
    else if ( num == 2 )
        return true;
    else if ( num % 2 == 0 )
        return false;

    for ( int i=3; i*i<=num; i+=2 ) {
        if ( num % i == 0 )
            return false;
    }
    return true;
}

static map<long long, long long> calc_prime_factor (
    long long num)
{
    map<long long, long long> prime_factor;
    for ( long long i=2; i*i<=num; i++ ) {
        while ( num % i == 0 ) {
            prime_factor[i]++;
            num /= i;
        }
    }
    if ( num != 1 )
        prime_factor[num]++;
    return prime_factor;
}

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

    map<long long, long long> prime_factor;
    prime_factor = calc_prime_factor(N);

    long long ans = 0;
    for ( auto itr : prime_factor ) {
        long long n = itr.second;
        long long cur = 1;
        while ( cur <= n ) {
            ans++;
            n -= cur;
            cur++;
        }
    }

    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3576
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x *= i;
    return x;
}

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

int main(){
    string s;
    cin>>s;
    string a=s.substr(0,(s.size()-1)/2),b=s.substr((s.size()-1)/2 + 1,(s.size()-1)/2);
    rep(i,s.size()/2){
        if(s[i]!=s[s.size() -i-1]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    rep(i,a.size()/2){
        if(a[i]!=a[a.size()-i-1]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    rep(i,b.size()/2){
        if(b[i]!=b[b.size()-i-1]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let D = xs[0];
   let T = xs[1];
   let S = xs[2];
   let ans = D/S;
    
   if(ans<=T){
   console.log('Yes');
   }else{
   console.log('No');
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 29684
package main

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

const devide int = 1000000007

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	N, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	K, _ := strconv.Atoi(sc.Text())

	A := make([]int, N)
	for i := 0; i < N; i++ {
		sc.Scan()
		A[i], _ = strconv.Atoi(sc.Text())
	}

	posts := 0
	alls := 0

	for i := 0; i < N; i++ {
		for j := 0; j < i; j++ {
			if A[i] > A[j] {
				alls++
			}
		}

		for j := i + 1; j < N; j++ {
			if A[i] > A[j] {
				alls++
				posts++
			}
		}
	}

	result := (posts*K + alls*((K-1)*K/2%devide)) % devide
	fmt.Println(result)
}


Measured memory_bytes: 640
# coding: utf-8

"""

"""

while True:
    s1 = raw_input()

    if s1 == '.':
        break

    s2 = raw_input()

    if s1 == s2:
        print "IDENTICAL"

    elif s1.count('"') != s2.count('"'):
        print "DIFFERENT"

    else:
        s1 = s1.split('"')
        s2 = s2.split('"')
        
        cnt = 0

        for i in range(len(s1)):
            if i % 2 == 1: 
                if s1[i] != s2[i]:
                    cnt += 1
            else:
                if s1[i] != s2[i]:
                    cnt += 2
                    break

        print "CLOSE" if cnt == 1 else "DIFFERENT"



Measured memory_bytes: 4660
#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;
int main() {
    int n;
    while (cin >> n, n) {
        vector <int> r, w;
        r = w = vector <int> (n);
        int sumR = 0, sumW = 0;
        rep (i, n) {
            cin >> r[i] >> w[i];
            sumR += r[i];
            sumW += w[i];
        }
        vector <int> copyR = r;
        sort(r.begin(), r.end());
        if (sumR >= 2*r.back()) {
            cout << sumR + sumW << endl;
            continue;
        }
        int gap = 2*r.back()-sumR;
        vector <vector <int>> dp(n + 1, vector <int> (gap + 1, 0));
        dp[0][0] = true;
        range (i, 1, n + 1) {
            dp[i]=dp[i-1];
            if (r.back() == copyR[i - 1]) {
                continue;
            }
            rep (j, gap + 1) {
                if (j - w[i - 1] < 0) continue;
                dp[i][j] |= dp[i - 1][j - w[i - 1]];
            }
        }
//      cout << endl;
        int maxJ = 0;
        rep (i, n + 1) rep (j, gap + 1) if (dp[i][j]) maxJ = max(maxJ, j);
        cout << sumR + sumW + (gap - maxJ) << endl;
    }
    return 0;
}



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

#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int MAX =510000;

ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N=in();
    int keta;
    int ans;ans=0;
    int val;
    REP1(i,N){
        keta=1;
        val=i;
        REP1(j,6){
            val/=10;
            if(val>0){
                keta++;
            }else{
                break;
            }
        }
        if(keta%2==1){
            ans++;
        }
    }
    cout<<ans<<endl;
    //cout<<fixed;
    return 0;
}


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

int main(){
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<s.size();i++){
        if(i%2==0){
            if(s[i]=='p'){
                ans--;
            }
        }else{
            if(s[i]=='g'){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 760
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	count := 0
	for i := 0; i < n-2; i++ {
		if string(s[i]) == "A" {
			if string(s[i+1]) == "B" {
				if string(s[i+2]) == "C" {
					count++
				}
			}
		}

	}
	fmt.Println(count)

}


Measured memory_bytes: 512
import math
import string
import collections
from collections import Counter
from collections import deque


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

H, W = map(int, input().split())
s = [None]*H
for i in range(H):
    s[i] = input()
    # print(s[i])
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            #print(i, j)
            if (i != 0 and s[i-1][j] == '#') or(i != H-1 and s[i+1][j] == '#')or(j != 0 and s[i][j-1] == '#') or(j != W-1 and s[i][j+1] == '#'):
                continue
            else:
                print('No')
                exit()
print('Yes')


Measured memory_bytes: 3832
#include<stdio.h>
int main()
{
	int H,W,h,w,ans;
	scanf("%d%d",&H,&W);
	scanf("%d%d",&h,&w);
	if(H>=1&&H<=20&&W>=1&&W<=20&&h>=1&&h<=H&&w>=1&&w<=W)
	{
		ans=((H*W)-(h*W)-(H*w)+(h*w));
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main (void)
{
    int a = 0;
    char s[10];

    scanf("%d",&a);
    scanf("%s",s);

    if (a >= 3200 )
    {
        printf("%s",s);
    }

    else 
    {
        printf("red\n");
    }

    return 0;
}



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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

//#define int int64_t
//int a[N+2];
vector<int>g[20];
int p[29];
int32_t  main(){
	IOS;
  int n,m;cin>>n>>m;
  for(int i=1;i<=m;++i){
    int sz;cin>>sz;
    while(sz--){
      int va;cin>>va;
      va--;
      g[i].pb(va);
    }
  }
  for(int i=1;i<=m;++i)cin>>p[i];
  //gen all subsets and find answer 
  int ans=0;
  for(int mask=0;mask<(1<<n);++mask){
    map<int,int>mm;
    for(int j=0;j<n;++j){
      //check if this mask is there or not 
      if(mask&(1<<j)){
        mm[j]=1;
      }
    }
    int cnt2=0;
    for(int i=1;i<=m;++i){
      int cnt=0;
      for(auto it:g[i]){
        if(mm[it]>0)cnt++;
      }
      if(cnt%2!=p[i]){
        break;
      }
      cnt2++;
    }
    if(cnt2==m){ans++;}
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

ll yaku(ll a, ll b){
    if(a>b) return yaku(b,a);
    else{
        if(b%a==0) return a;
        else return yaku(b%a,a);
    }
}

long long ruijou(ll n, ll k){
    if(k==0) return 1;
    ll x=k/2;
    long long t=ruijou(n,x);
    t=(t*t)%mod;
    if(k%2==1) return (n*t)%mod;
    else return t%mod;
}

int main(){
    ll N,K; cin>>N>>K;
    vec ans(K+1,0);
    for(ll i=K; i>0; i--){
        ll p=K/i;
        ans.at(i)=ruijou(p,N);
        if(p>1){
            REP(j,2,p+1) ans.at(i)=(ans.at(i)+mod-ans.at(i*j));
        }
    }
    ll ANS=0;
    REP(i,1,K+1) ANS=(ANS+ans.at(i)*i)%mod;
    cout<<ANS<<endl;
}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

	ll n, m;
	cin >> n >> m;
	vll a(3);
	vvll sum(8, vll(n, 0));
	REP(i, n){
		REP(j, 3) cin >> a[j];
		REP(j, 1 << 3){
			REP(k, 3){
				if((j >> k) & 1) sum[j][i] += a[k];
				else sum[j][i] -= a[k];
			}
		}
	}
	ll res = 0;
	REP(i, 8){
		VSORTR(sum[i]);
		ll tmp = 0;
		REP(j, m) tmp += sum[i][j];
		res = max(res, tmp);
	}
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int n) {
	if (n < 4) return true;
  	if (n % 2 == 0 || n % 3 == 0) return false;
  	for (int i = 5; i * i <= n; i += 6) {
    	if (n % i == 0 || n % (i + 2) == 0) return false;
    }
  	return true;
}
int main() {
	int n; cin >> n;
  	int max_val = 1e6;
  	for (int i = n; i < max_val; i ++) {
    	if (isPrime(i)) {
        	cout << i << endl;
          	return 0;
        }
    }
}

Measured memory_bytes: 256
N, M = map(int, input().split())
a = list(map(int, input().split()))

from math import floor
from fractions import gcd
from functools import reduce


def lcm(x, y):
    return x * y // gcd(x, y)


b = [n // 2 for n in a]

lcm_b = reduce(lcm, b)

for n in b:
    if (lcm_b // n) % 2 == 0:
        print(0)
        exit()

n = floor((M / lcm_b - 1) / 2) + 1

print(n)


Measured memory_bytes: 88672
import std.stdio, std.string, std.uni;

void main() {
    string str = readln.chomp;
    foreach (x; str) {
        if (x.isUpper) {
            x.toLower.write;
        } else if (x.isLower) {
            x.toUpper.write;
        } else {
            x.write;
        }
    }
    writeln;
}


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

int main() {
    int N; cin >> N;
    vector<ll> v(1e8);
    for (int i = 1; i <= N; ++i) {
        for (int j = i; j <= N; j += i) {
            v[j]++;
        }
    }
    ll ans = 0;
    for (int i = 1; i <= N; ++i) {
        ans += i * (v[i]);
    }
    cout << ans << endl;
}



Measured memory_bytes: 784436
N ,M = map(int,input().split())
L = []
for i in range(1,int(M**(1/2)+1)):
    if M % i == 0:
        L.append((i,M//i))
ans = 0
for x in L:
    if x[1] >= N:
        ans = max(ans,x[0])
    if x[0] >= N:
        ans = max(ans,x[1])
print(ans)


Measured memory_bytes: 3060
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> a = new ArrayList<>();
        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            a.add(sc.nextInt());
            set.add(a.get(i));
        }
        if(set.size() == 1) {
            System.out.println(0);
            return;
        }
        int max = Collections.max(a);
        int min = Collections.min(a);
        //Collections.sort(a);
        int ans = Integer.MAX_VALUE;
        for (int i = min; i <= max; i++) {
            int sum = 0;
            for (int b : a) {
                if(i != b) {
                    sum += Math.pow(b - i, 2);
                }
            }
            ans = Math.min(ans, sum);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35968
// 2014/11/08 Tazoe

#include <iostream>
#include <algorithm>
using namespace std;

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

	int m;
	cin >> m;

	int S = m;
	int S_max = S;
	bool err = false;

	for(int i=0; i<n; i++){
		int a, b;
		cin >> a >> b;

		S += (a-b);

		if(S<0){
			err = true;
		}

		S_max = max(S_max, S);
	}

	if(err){
		cout << 0 << endl;
	}
	else{
		cout << S_max << endl;
	}

	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int maxn = 1e5+10;

int n,k,a[maxn];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n>>k;
    ll res = 1e18;
    for (int i=1;i<=n;i++) cin>>a[i];
    for (int i=1;i<=n-k+1;i++) {
        ll l = a[i], r = a[i+k-1];
        if (r<=0) res = min(res,-l);
        else if (l>=0) res = min(res,r);
        else {
            res = min(res,-2*l + r);
            res = min(res,2*r-l);
        }
    }
    cout<<res<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>

using namespace std;

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

    
    if(S[K-1] == 'A')
        S[K-1] = 'a';
    else if(S[K-1] == 'B'){
        S[K-1] = 'b';
    }
    else
        S[K-1] = 'c';

    
    cout << S << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String a = sc.next();
		if (a.equals("Sunny")) {
			System.out.println("Cloudy");
		} else if (a.equals("Cloudy")) {
			System.out.println("Rainy");
		} else {
			System.out.println("Sunny");
		}

	}
}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
# abc136/abc136_b
import sys
from math import log10

N = int(sys.stdin.readline().rstrip())
len_n = int(log10(N)) + 1
s = N - 10**(len_n - 1) + 1 if len_n % 2 else 0
for i in range(1, len_n, 2):
    s += 9 * 10**(i - 1)
print(s)


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;


int main()
{

    int n, m;
    cin >> n >> m;
    vector<int>h(n+1);
    for (int i = 0; i < n; i++) {
        cin >> h[i+1];
    }
    int ans = n;
    vector<bool>f(n + 1);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        if (h[a] > h[b]) {
            if (!f[b]) {
                f[b] = 1;
                ans--;
            }
        }
        else if(h[a]<h[b]){
            if (!f[a]) {
                f[a] = 1;
                ans--;
            }

        }
        else if (h[a] == h[b]) {
            if (!f[b]) {
                f[b] = 1;
                ans--;
            }
            if(!f[a]) {
                f[a] = 1;
                ans--;
            }
        }
    }
   
    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3404
#include<cstdio>

const int N = 131072;
int prime[N] = {0},num_prime = 0;
int isNotPrime[N] = {1, 1};

int main()
{
    int n;
    for(long i=2; i<(2<<17); i++)
    {
        if(!isNotPrime[i])
            prime[num_prime++]=i;
        for(long j = 0 ; j < num_prime && i * prime[j] <  N ; j ++)
        {
            isNotPrime[i * prime[j]] = 1;
            if( !(i % prime[j] ) )
                break;
        }
    }
    while(~scanf("%d",&n),n)
    {
        int cnt = 0;
        for(int i=0; prime[i]<n; i++)
            for(int j=i; prime[j]<n; j++)
                if(prime[i] + prime[j] == n)
                    cnt++;
        printf("%d\n",cnt);
    }
    return 0;
}

Measured memory_bytes: 2052
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int inf = 1001001001;
 
int main(){
  double r;
  cin >> r;
  cout << 2*r*3.1415 << endl;
 
}


Measured memory_bytes: 3784
def isDifValEach( a )
  sizeNum = a.size - 1
  checkflag = false 

  for i in 0..sizeNum
    for j in (i+1)..sizeNum
      if a[i] == a[j]
        return checkflag
      end
    end
  end
    
  checkflag = true

end

inputArray = gets.chomp.split.map(&:to_i)

if inputArray == inputArray.sort && isDifValEach(inputArray)
    puts 'Yes'
else
    puts 'No'
end


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



i64 k,a,b;
void solve(){
	cin >> k >> a >> b;
	
	cout << max(k+1,((k-a+1)/2>0?(k-a+1)/2*(b-a)+a:0) + (k-a+1)%2) << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

void rc(vector<int> &now, int n, int m, const vector<tuple<int, int, int, int>> &vt, ll &ans){
  if(now.size() == n){
    ll add = 0;
    for(auto t : vt){
      auto[a, b, c, d] = t;
      if(now.at(b) - now.at(a) == c) add += d;
    }
    ans = max(ans, add);
    return ;
  }
  int bk = 1;
  if(now.size() > 0) bk = now.back();
  rep2(i, bk, m+1){
    now.push_back(i);
    rc(now, n, m, vt, ans);
    now.pop_back();
  }
}

int main(){
  int n, m, q;
  cin >> n >> m >> q;
  vector<tuple<int, int, int, int>> vt(q);
  rep(i, q){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a--; b--;
    vt.at(i) = {a, b, c, d};
  }
  vector<int> now;
  ll ans = 0;
  rc(now, n, m, vt, ans);
  cout << ans << endl;

  return 0;
}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const long long MOD = 1000000007LL;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int n;
    cin >> n;

    vector<lint> sum(n + 1);
    reps(i, n){
        cin >> sum[i];
        sum[i] += sum[i - 1];
    }

    unordered_map<lint, lint> mp;
    lint ans = 0;
    rep(i, n + 1){
        ans += mp[sum[i]];
        ++mp[sum[i]];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 10056
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 2;

bool dfs(int N, int M, vector< vector<bool> >& adj, vector<int>& a, vector<int>& b, int i, vector<bool>& vis) {
	vis[i] = true;
	for (int j = 0; j < M; j++) {
		if (!adj[i][j] || a[i] == j) continue;
		if (b[j] == -1) {
			b[j] = i;
			a[i] = j;
			return true;
		}
		for (int _i = 0; _i < N; _i++) {
			if (!adj[_i][j] || b[j] != _i || vis[_i]) continue;
			if (dfs(N, M, adj, a, b, _i, vis)) {
				b[j] = i;
				a[i] = j;
				return true;
			}
		}
	}
	return false;
}

int match(int N, int M, vector< vector<bool> >& adj) {
	vector<int> a(N, -1), b(M, -1);
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		if (a[i] != -1) continue;
		vector<bool> vis(N);
		if (dfs(N, M, adj, a, b, i, vis))
			cnt++;
	}
	return cnt;
}

int main() {
	for (;;) {
		int N, M; cin >> N >> M;
		if (N == 0) break;
		vector<int> x(N), y(N), v(N);
		for (int i = 0; i < N; i++)
			cin >> x[i] >> y[i] >> v[i];
		vector<int> X(M), Y(M);
		for (int j = 0; j < M; j++)
			cin >> X[j] >> Y[j];
		double lb = 0, ub = 20000;
		for (int t = 0; t < 50; t++) {
			double mid = (lb + ub) / 2;
			vector< vector<bool> > adj(N, vector<bool>(M));
			for (int i = 0; i < N; i++)
				for (int j = 0; j < M; j++) {
					double dx = X[j] - x[i], dy = Y[j] - y[i];
					adj[i][j] = (sqrt(dx * dx + dy * dy) <= mid * v[i]);
				}
			if (match(N, M, adj) == M) ub = mid;
			else lb = mid;
		}
		printf("%.10f\n", lb);
	}
}

Measured memory_bytes: 1260
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int mod = 1e9 + 7;
int n, c[200000], d[200000], t[200000], dp[200000];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", c + i), c[i]--;
	for (int i = n - 1; 0 <= i; i--) {
		d[i] = t[c[i]];
		t[c[i]] = i;
	}
	int sum = 1;
	for (int i = 0; i < n; i++) {
		sum = (sum + dp[i]) % mod;
		if (!d[i] || d[i] == i + 1)
			continue;
		dp[d[i]] = (dp[d[i]] + sum) % mod;
	}
	printf("%d\n", sum);
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    if(a < b){
        cout << "a < b" << endl;
    }
    if(a == b){
        cout << "a == b" << endl;
    }
     if(a > b){
        cout << "a > b" << endl;
    }
	
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
using namespace placeholders;
using ll = long long;
 
ll gcd(const ll a, const ll b){
    return a == 0 ? b : gcd(b%a, a); }
 
bool first_wins(vector<ll>& v){
    v.erase(remove(begin(v), end(v), 1), end(v));
    if(v.size() == 1) return (v[0]+1)%2;
    static auto is_odd = [](const ll x){ return x%2 == 1; };
    const ll nr_odd = count_if(begin(v), end(v), is_odd);
    if((nr_odd + v.size())%2) return true;
    else if(nr_odd != 1) return false;
    else if(*find_if(begin(v), end(v), is_odd) == 1) return false;
    else{
        --*find_if(begin(v), end(v), is_odd);
        const ll full_gcd = accumulate(begin(v), end(v), v.front(), &gcd);
        transform(begin(v), end(v), begin(v), bind(divides<ll>(), _1, full_gcd));
        return !first_wins(v); } }
 
int main(){
    ll n;
    cin >> n;
    vector<ll> v(n);
    for(auto& x : v) cin >> x;
    cout << (first_wins(v) ? "First" : "Second") << endl;
    return 0; }


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

long long power( long long x, long long n, long long m )
{
	long long res = 1;
	while( n > 0 ) {
		if( n % 2 ) res = res * x % m;
		x = x * x % m;
		n /= 2;
	}
	return res;
}

int main()
{
	int N;
	cin >> N;
	vector<long long> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}

	vector<map<long long, long long>> p( N );
	for( int i = 0; i < N; i++ ) {
		long long a = A[i];
		for( int j = 2; j * j <= a; j++ ) {
			while( a % j == 0 ) {
				p[i][j]++;
				a /= j;
			}
		}
		p[i][1]++;
		if( a != 1 ) p[i][a]++;
	}
	map<long long, long long> lcdv;
	for( int i = 0; i < N; i++ ) {
		for( auto it = p[i].begin(); it != p[i].end(); it++ ) {
			long long e = it->first;
			long long n = it->second;
			if( lcdv[e] < n ) lcdv[e] = n;
		}
	}
	const long long MOD = 1000000000 + 7;
	long long lcd = 1;
	for( auto it = lcdv.begin(); it != lcdv.end(); it++ ) {
		long long e = it->first;
		long long n = it->second;
		lcd *= power( e, n, MOD );
		lcd %= MOD;
	}

	long long ans = 0;
	for( int i = 0; i < N; i++ ) {
		ans += lcd * power( A[i], MOD - 2, MOD );
		ans %= MOD;
	}

	cout << ans << endl;
}


Measured memory_bytes: 7412
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin >> a >> b;
    if(a <= b){
        for(int i = 0; i < b; i++){
            cout << a;
        }
    }
    else if(a > b){
        for(int i = 0; i < a; i++){
            cout << b;
        }
    }
    cout << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner io = new Scanner(System.in);
		int a = io.nextInt(), b = io.nextInt();
		if(a != 1 && b != 1) System.out.println(1);
		if(a != 2 && b != 2) System.out.println(2);
		if(a != 3 && b != 3) System.out.println(3);
	}
}

Measured memory_bytes: 21844
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>

using namespace std;

void solve(int K) {
  int a = K / 2;
  printf("%d\n", a * (K - a));
}

int main() {
  int K;
  cin >> K;
  solve(K);
  return 0;
}

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


int main() {
    int n, m;
    cin >> n >> m;
    int a[10000], b[10000];
    while (n != 0 && m != 0) {
        vector<int> adj[n];
        for (int i = 0; i < m; i++) {
            cin >> a[i] >> b[i];
            a[i]--;
            b[i]--;
            adj[a[i]].push_back(b[i]);
            adj[b[i]].push_back(a[i]);
        }
        set<int> s;
        for (int i = 0; i < adj[0].size(); i++) {
            int u = adj[0][i];
            s.insert(u);
            for (int j = 0; j < adj[u].size(); j++) {
                s.insert(adj[u][j]);
            }
        }
        if (s.size() == 0) {
            cout << 0 << "\n";
        } else {
            cout << s.size() - 1 << "\n";
        }
        cin >> n >> m;
    }
    return 0;
}


Measured memory_bytes: 3304
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
const Int MAX = 1000;
Int dp[33][33][MAX];
signed main(){
  Int h,w;
  cin>>h>>w;
  vector<vector< Int> > a(h,vector<Int>(w));
  for(Int i=0;i<h;i++)
    for(Int j=0;j<w;j++)
      cin>>a[i][j];
  using T = tuple<Int, Int, Int, Int>;
  priority_queue<T,vector<T>,greater<T> > pq;
  memset(dp,-1,sizeof(dp));
  dp[0][0][0]=0;
  pq.emplace(dp[0][0][0],0,0,0);
  auto in=[h,w](Int y,Int x){
    return 0<=y&&y<h&&0<=x&&x<w;
  };
  while(!pq.empty()){
    Int d,y,x,t;
    tie(d,y,x,t)=pq.top();pq.pop();
    if(dp[y][x][t]<d) continue;
    if(y==h-1&&x==w-1) break;
    //cout<<y<<" "<<x<<" "<<t<<":"<<d<<endl;
    Int dy[]={0,1,0,-1};
    Int dx[]={1,0,-1,0};
    if(t+1>=MAX) continue;
    for(Int k=0;k<4;k++){
      Int ny=y+dy[k],nx=x+dx[k],nt=t+1;
      if(!in(ny,nx)) continue;
      Int nc=a[ny][nx]*(t*2+1)+1;
      if(ny==h-1&&nx==w-1) nc-=t+1;
      if(dp[ny][nx][nt]<0||d+nc<dp[ny][nx][nt]){
	dp[ny][nx][nt]=d+nc;
	pq.emplace(dp[ny][nx][nt],ny,nx,nt);
      }
    }
  }
  Int ans=-1;
  for(Int i=0;i<MAX;i++)
    if(~dp[h-1][w-1][i])
      if(ans<0||dp[h-1][w-1][i]<ans)
	ans=dp[h-1][w-1][i];
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 19720
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a)  (a).begin(),(a).end()
#define P pair<int, int>
#define ll long long
const int MOD = 1000000007;
//bitset<64>(x).count()
//fixed << setprecision(15) << 

int main(){
  int n, tmp;
  cin >> n;
  pair<pair<string, int>, int> p[n];
  string s;
  rep(i, n){
    cin >> s >> tmp;
    p[i] = make_pair(make_pair(s, tmp*-1), i+1);
  }
  sort(p, p+n);
  rep(i, n)
    cout << p[i].second << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
#define pb push_back
using ll = long long;
const int INF = 1e9+7;
const int EPS = -1e6;
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}
const int maxn = 100000+5;

string s;

int main(){
    //freopen("input.txt", "r", stdin);
    fastio();

    cin>>s;

    int ans = INF;
    for(int i = 0; i < (int)s.size()-3+1; ++i){
        int t = stoi(string{s[i],s[i+1],s[i+2]});
        ans = min(ans, abs(t - 753));
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
#ABC133 E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k = LI()
graph = [[] for _ in range(n)]
for _ in range(n-1):
    a,b = LI()
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

lst = [-1]*n
lst[0] = k
que = deque()
que.append(0)
while que:
    v = que.popleft()
    if v == 0:
        cnt = 1
    else:
        cnt = 2
    for u in graph[v]:
        if lst[u] < 0:
            que.append(u)
            lst[u] = k - cnt
            cnt += 1
ans = 1
for i in lst:
    ans *= i
    ans %= mod
print(ans)

Measured memory_bytes: 62000
//g++ -std=c++14 test.cpp -o test.out
//URL
//https://atcoder.jp/contests/abc092/tasks/arc093_b

//参考：https://pitsbuffersolution.com/compro/atcoder/arc093d.php

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL A,B;
 
vector<vector<char>> ans;

void solve(){
	ans = vector<vector<char>>(100,vector<char>(100));
	for(int h=0;h<50;h++){
		for(int w=0;w<100;w++) ans[h][w] = '#';
	}
	for(int h=50;h<100;h++){
		for(int w=0;w<100;w++) ans[h][w] = '.';
	}
	//この時点でansには上半分が全部#(黒),下半分が全部.(白)のグリッドが生成される
	//その連結成分は白黒それぞれ1,1

	//上半分の黒で塗り潰された箇所に白を1マスずつ塗っていく
	//この時(0,0)を始点として、上下左右に白が隣り合わないように
	//1マスずつ塗っていく

	//最大数白を塗った時白の連結成分の数は
	//グリッド全体の下半分の白の連結成分も含めて
	//50*24 + 1 = 1201個作れ、A<=500なことを考えると十分
	//黒の連結成分についても同様
	[](){
		for(int h=0;h<50;h+=2){
			for(int w=0;w<100;w+=2){
				if(A == 1) return;
				ans[h][w] = '.';
				--A;//白のあと必要な連結成分数を減らす
			}
		}
	}();
	[](){
		for(int h=99;h>50;h-=2){
			for(int w=0;w<100;w+=2){
				if(B == 1) return;
				ans[h][w] = '#';
				--B;//黒のあと必要な連結成分数を減らす
			}
		}
	}();
}

int main(){
    cin >> A >> B;
 
    solve();

    cout << ans.size() << " " << ans[0].size() << endl;
    for(int h=0;h<ans.size();h++){
    	for(int w=0;w<ans[0].size();w++) cout << ans[h][w];
    		cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  int nt, nx, ny;
  nt = nx = ny = 0;
  rep(i, n){
    int t, x, y;
    cin >> t >> x >> y;
    int d = abs(x - nx) + abs(y - ny);
    int dt = t - nt;
    // cerr << d << " " << dt << endl;
    if((d > dt) || (dt % 2 != d % 2)){
      cout << "No" << endl;
      return 0;
    }
    nt = t; nx = x; ny = y;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

func solve() {
	n := getInt()
	a, b := n*100/108, (n*100/108)+1

	ans := ":("
	if a*108/100 == n {
		ans = strconv.Itoa(a)
	} else if b*108/100 == n {
		ans = strconv.Itoa(b)
	}
	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getFloat() float64 {
	f, err := strconv.ParseFloat(getString(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func getRunes() []rune {
	return []rune(getString())
}


Measured memory_bytes: 640
#include <iostream>
#include <utility>
#include <algorithm>

using namespace std;

int N, M;
pair< int, pair<int, int> > range[300005];

int bit[300005];

int query(int i)
{
	int ret = 0;
	while(i > 0){
		ret += bit[i];
		i -= i & (-i);
	}
	return ret;
}

void add(int i, int val)
{
	while(i <= M+1){
		bit[i] += val;
		i += i & (-i);
	}
}

int main(void)
{
	cin >> N >> M;
	int l, r;
	for(int i = 0; i < N; i++){
		cin >> l >> r;
		range[i] = make_pair(r-l+1, make_pair(l, r));
	}
	sort(range, range+N);

	int p = 0;
	for(int i = 1; i <= M; i++){
		while(p < N && range[p].first < i){
			add(range[p].second.first, 1);
			add(range[p].second.second + 1, -1);
			p++;
		}
		int ans = 0;
		for(int j = i; j <= M; j+=i) ans += query(j);
		cout << ans + (N - p) << endl;
	}
	return 0;
}

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

int main() {
    
    string S;
    cin >> S;
    
    if(S[0] == S[1] && S[1] == S[2]){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }


}


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

using namespace std;
const int MAXN = 1e5 + 7;

inline int R()
{
	char ch = getchar();
	int rt = 0;
	bool isn = false;
	for ( ; ch < '0' || ch > '9'; ch = getchar() )
		isn = ch == '-' ? true : isn;
	for ( ; ch >= '0' && ch <= '9'; ch = getchar() )
		rt = rt * 10 + ch - '0';
	return isn ? -rt : rt;
}

int a[MAXN], b[MAXN], num[MAXN << 1], sa[MAXN], sb[MAXN], u[MAXN << 1];
map<int, int> hs;

bool Cmp ( int t1, int t2 )
{
	return t1 < t2;
}

int f[MAXN << 1];

int Fnd ( int nf )
{
	return f[nf] == nf ? nf : f[nf] = Fnd ( f[nf] );
}

int main()
{
//	freopen ( "duliu.in", "r", stdin );
//	freopen ( "duliu.out", "w", stdout );
	int n = R(), ns = 0, nn = 0, nun = 0;
	for ( int i = 1; i <= n; ++i )
		a[i] = R(), ns ^= a[i], num[++nn] = a[i], sa[i] = a[i];
	sa[n + 1] = ns, num[++nn] = ns;
	int bs = 0, ans = 0;
	for ( int i = 1; i <= n; ++i )
		b[i] = R(), num[++nn] = b[i], bs ^= b[i], sb[i] = b[i];
	sb[n + 1] = bs, num[++nn] = bs;
	sort ( sa + 1, sa + n + 2, Cmp ), sort ( sb + 1, sb + n + 2, Cmp );
	for ( int i = 1; i <= n + 1; ++i )
		if ( sa[i] != sb[i] )
		{
			puts ( "-1" );
			return 0;
		}
	sort ( num + 1, num + nn + 1, Cmp );
	num[0] = -1;
	for ( int i = 1; i <= nn; ++i )
		if ( num[i] != num[i - 1] )
			hs[num[i]] = ++nun;
	ns = hs[ns];
	for ( int i = 1; i <= nun; ++i )
		f[i] = i;
	for ( int i = 1; i <= n; ++i )
		a[i] = hs[a[i]], b[i] = hs[b[i]];
	for ( int i = 1; i <= n; ++i )
		if ( a[i] != b[i] )
		{
			int fa = Fnd ( a[i] ), fb = Fnd ( b[i] );
			if ( fa != fb )
				f[fa] = fb;
			++ans;
		}
	for ( int i = 1; i <= n; ++i )
		if ( a[i] != b[i] )
		{
			int fa = Fnd ( a[i] ), fb = Fnd ( b[i] );
			if ( !u[fa] )
				u[fa] = true, ++ans;
			if ( !u[fb] )
				u[fb] = true, ++ans;
		}
	if ( u[Fnd ( ns )] )
		--ans;
	printf ( "%d\n", ans );
	return 0;
}

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

ll gcd(ll x, ll y) {
	ll a = max(x,y);
	ll b = min(x,y);
	ll r = a % b;
	while(r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

int main() {
	ll a,b;
	cin >> a >> b;
	ll r = gcd(a,b);
	cout << a * b / r << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#pragma GCC optimize("O3")
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back

using namespace std;
using ll=long long;
// using ll=int;

const ll mod = (ll)(1e9+7);

typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;


int main(){

    /*
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("myoutput.txt", "w", stdout);
    #endif
    */

    fast;
    ll t = 1;
    // cin >> t;
    while(t--){
        double l; cin >> l;
        cout << fixed;
        cout << setprecision(6);
        cout << pow((l/3), 3) << endl;
        
    }
    // cerr << (double)clock()/CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 256