akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int N, K;
int x[100010];
int acc[100010];


void makeAcc(){
	rep(i, 1, N) acc[i] = acc[i-1]+(x[i]-x[i-1]);
}


int solve(){
	int p1 = lb(RNG(x, 0, N), 0)-&x[0];
	int p2 = p1-1;
	int ans = INF;
	if(p1 != N){
		rep(i, 0, p1){
			if(p1-i+1 >= K){
				chmin(ans, acc[p1]-acc[i]+x[p1]);
				continue;
			}
			if(K+i-1 < N) chmin(ans, acc[p1]-acc[i]+acc[K+i-1]-acc[i]+x[p1]);
		}
		rep(i, p1, N){
			if(i-p1+1 >= K){
				chmin(ans, acc[i]-acc[p1]+x[p1]);
				continue;
			}
			if(-K+i+1 >= 0) chmin(ans, acc[i]-acc[p1]+acc[i]-acc[-K+i+1]+x[p1]);
		}
	}
	if(p2 != -1){
		rep(i, 0, p2){
			if(p2-i+1 >= K){
				chmin(ans, acc[p2]-acc[i]-x[p2]);
				continue;
			}
			if(K+i-1 < N) chmin(ans, acc[p2]-acc[i]+acc[K+i-1]-acc[i]-x[p2]);
		}
		rep(i, p2, N){
			if(i-p2+1 >= K){
				chmin(ans, acc[i]-acc[p2]-x[p2]);
				continue;
			}
			if(-K+i+1 >= 0) chmin(ans, acc[i]-acc[p2]+acc[i]-acc[-K+i+1]-x[p2]);
		}
	}
	return ans;
}


signed main(){
	cin >> N >> K;
	rep(i, 0, N) cin >> x[i];

	makeAcc();

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 1792
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)1e5+100;


int main(void) {
   ll N,M;
   cin>>N>>M;
   ll ans = 0;
   if (N==1) {
      if (M==1) ans = 1;
      else ans = M-2;
   } else if (M==1) {
      ans = N-2;
   } else ans = (N-2) * (M-2);
   cout<<ans<<endl;

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    long long point, x, count = 0;
    cin >> x;
    point = x;
    count = x / 11;
    count*=2;
    point %= 11;
    if (point > 6)
        count += 2;
    else if (point <= 0)
    {
    }
    else
        count++;
    cout << count;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

int main() {
    FAST_IO();
    int N, K; cin >> N >> K;
    vector<int> A(N + 1);
    vector<int> psum(N + 1), F(N + 1);
    /* F[i] = psum[i] - i */
    map<int, vector<int>> mp;
    mp[0] = vector<int> {0};
    repp(i, 1, N) {
        cin >> A[i];
        psum[i] = (psum[i - 1] + A[i]) % K;
        F[i] = (psum[i] - i % K + K) % K;
        if(mp.find(F[i]) == mp.end()) {
            vector<int> x = {i};
            mp[F[i]] = x;
        } else {
            mp[F[i]].push_back(i);
        }
    }
    ll ans = 0;
    repp(i, 0, N - 1) {
        auto &V = mp[F[i]];
        int curr = lower_bound(all(V), i) - V.begin();
        int last = upper_bound(all(V), i + K - 1) - V.begin() - 1;
        int cnt = last - curr + 1;
        // cout << "i : " << i << " F[i] : " << F[i] << " last : " << last << " cnt : " << cnt << "\n";
        ans += cnt - 1;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 24576
### global variables

$sum_cache = []

### subroutines

def count_sum(k, cards, sum)
  return $sum_cache[k][sum] if ! $sum_cache[k][sum].nil?

  if k >= cards.length
    return ($sum_cache[k][sum] = (sum == 0) ? 1 : 0)
  end

  a, b = cards[k]
  count = 0

  for bn in (0..b)
    sum0 = sum - a * bn
    break if sum0 < 0
    count += count_sum(k + 1, cards, sum0)
  end

  $sum_cache[k][sum] = count
end

### main

while true
  m = gets.strip.to_i
  break if m == 0

  cards = []
  $sum_cache = Array.new(m + 1){[]}

  m.times.each do
    a, b = gets.strip.split(' ').map{|s| s.to_i}
    cards << [a, b]
  end

  g = gets.strip.to_i
  g.times.each do
    gn = gets.strip.to_i

    c = count_sum(0, cards, gn)
    puts c
  end
end

Measured memory_bytes: 6192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            // 出力
            System.Console.WriteLine("{0}", (int.Parse(sS[0]) - int.Parse(sS[1]) + 1).ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N-1);
  for(int i=0;i<N;++i){
    cin>>A.at(i);
  }
  for(int i=0;i<N;++i){
    cin>>B.at(i);
  }
  for(int i=0;i<N-1;++i){
    cin>>C.at(i);
  }


  int manzoku=0;

  for(int i=0;i<N;++i){
    manzoku=manzoku+B.at(A.at(i)-1);
    if(i>0 && A.at(i)==A.at(i-1)+1){
      manzoku=manzoku+C.at(A.at(i-1)-1);
    }
  }

  cout<<manzoku<<endl;
}

Measured memory_bytes: 256
import string


S = list(input())
T = list(input())

L = list(string.ascii_lowercase)

S = [L.index(s) for s in S]
T = [L.index(t) for t in T]

S.sort()
T.sort()
T.reverse()

while True:
    if len(S) == 0:
        if len(T) > 0:
            print('Yes')
            break
        else:
            print('No')
            break
    if len(T) == 0:
        print('No')
        break
    s = S[0]
    t = T[0]
    if s < t:
        print('Yes')
        break
    elif s == t:
        del S[0]
        del T[0]
    else:
        print('No')
        break


Measured memory_bytes: 3768
#include <iostream>
#include <string>
#include <vector>
#define _USE_MATH_DEFINENS
#include <cmath>

using namespace std;

#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    int n;
    cin >> n;
    int total;
    bool flag = false;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            total = 4 * i + 7 * j;
            if(total == n) flag = true;
        }
    }
    if(flag == false){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  ll sum = accumulate(all(A), 0LL);
  if(sum % (N*(N+1)/2)) {
    cout << "NO" << "\n";
    return 0;
  }
  int M = sum / (N*(N+1)/2);
  vector<ll> D(N);
  bool ok = true;
  int cnt = 0;
  rep(i, N) {
    D[i] = A[(i+1)%N]-A[i]-M;
    if(D[i] > 0 || -D[i] % N) {
      cout << "NO" << "\n";
      return 0;
    }
    cnt += -D[i] / N;
  }
  cout << (cnt == M ? "YES" : "NO") << "\n";
  return 0;
}


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

d = [0] * (n+1)
ans = 1
for i in range(1, n+1):
    d[i] = d[i-1] + l[i-1]
    if d[i] <= x:
        ans += 1

print(ans)


Measured memory_bytes: 9112
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define ll long long
#define ld long double
#define sz(a) ((int)(a).size())
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()
#define pii pair<int,int>
#define pdd pair<ld,ld> 
#define rep(i,a,b) for(int i=a; i<b; i++)
#define dec(i,a,b) for(int i=a; i>=b; i--)
#define ler freopen("inspection.in","r",stdin);freopen("inspection.out","w",stdout)
#define fastio ios::sync_with_stdio(0), cin.tie(0)
#define debug cout<<"!!?!!\n"
using namespace std;
#define PI 2*asin(1) 
#define EPS 1e-9
#define MOD 1000000007
#define MAXN 404LL
#define INF 2000000000000000LL

int main(){
	ll x;
	cin >> x;
	
	ll i=1, sum=1;
	while(sum<x){
		i++;
		sum+=i;
	}
	cout << i << endl;
}












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

map<ll,ll>l2;

int main()
{
    ll n;
    ll x;
    cin>>x>>n;
    ll l1[n+1];
    for(int i=1;i<=n;i++){
        cin>>l1[i];
        l2[l1[i]]=1;
    }
    if(!l2[x]){cout<<x<<endl;return 0;}
    for(int i=1;i<=n;i++){
        if(!l2[x-i]){
            cout<<x-i<<endl;return 0;
        }
        else if(!l2[x+i]){
            cout<<x+i<<endl;return 0;
        }
    }
    cout<<x<<endl;

    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(){
    int x, a, b;
    cin >> x >> a >> b;
    if(b-a<=0){
        cout << "delicious" << endl;
    }else if(b-a<=x){
        cout << "safe" << endl;
    }else{
        cout << "dangerous" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 1e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
#define eb emplace_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define mp make_pair
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 1e5 + 100;
const int LOG = 21;
const int mod = 1e9 + 7;
const int MX = 1e6;
typedef long long li;

template<class T1, class T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &rhs) {
    out << "( " << rhs.first << " , " << rhs.second << " )";
    return out;
}

void solve() {
    int n, k;
    cin >> n >> k;
    deque<int> d;
    int total = 0;
    for (int i = 1; i <= n; ++i) {
        char a;
        cin >> a;
        if (a == 'A') {
            d.push_back(0);
        } else {
            d.push_back(1);
        }
    }


    if(k > 2 * n){
        if(k % 2 == 0){
            k = 2 * n + 2;
        } else{
            k = 2 * n + 1;
        }
    }
    for (int i = 1; i <= k; ++i) {
        if ((d.front() ^ total) == 0) {
            d.pop_front();
            d.push_front(total ^ 1);
        } else {
            d.pop_front();
            total ^= 1;
            d.push_back(total);
        }
    }

    while (!d.empty()) {
        int res = d.front(); d.pop_front();
        res = res ^ total;

        if(res == 0){
            cout <<"A";
        } else{
            cout <<"B";
        }
    }

}

signed main() {
#ifdef zxc
    debug = 1;
    freopen("../input.txt", "r", stdin);
    //  freopen("../output.txt", "w", stdout);
#else

#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);

    int t = 1;
    for (int j = 1; j <= t; ++j) {
        solve();
    }
    if (debug) {
        cerr << endl;
        cerr << endl << "time : " << (1.0 * clock() / CLOCKS_PER_SEC) << endl;
    }

}

Measured memory_bytes: 1280
import math
a, b, x = map(int, input().split())

if (a*a*b)/2 > x:
    ans = 90-math.degrees(math.atan((2*x)/(a*b*b)))
else:
    ans = math.degrees(math.atan(2*b/a - 2*x/(a*a*a)))

print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
   int j,k,t;
   cin>>j>>k>>t;
   if(j+k==t||j+t==k||k+t==j){
       cout<<"Yes"<<endl;
   }
   else{
       cout<<"No"<<endl;
   }
}

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

using namespace std;

#define first ff
#define second ss

int main() {
#ifdef LOCAL
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
#else
    // freopen("levenshtein.in", "r", stdin);
    // freopen("levenshtein.out", "w", stdout);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, r;
    cin >> n >> r;
    if (n >= 10) {
        cout << r;
    } else {
        cout << r + 100 * (10 - n);
    }

    return 0;
}


Measured memory_bytes: 256
#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 = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M; cin >> N >> M;
    int state = (1 << N);
    int A[M], B[M];
    rep(i, M){
        int a, k; cin >> a >> k;
        A[i] = a;
        int acc = 0;
        rep(j, k){
            int c; cin >> c;
            acc += (1 << (c-1));
        }
        B[i] = acc;
    }

    vector<int> dp[M+1];
    rep(i, M+1) dp[i].resize(state);
    rep(i, M+1) rep(j, state) dp[i][j] = INF;
    dp[0][0] = 0;
    for(int i = 0; i < M; i++){
        for(int j = 0; j < state; j++){
            int to = j | B[i];
            dp[i+1][to] = min(dp[i+1][to], dp[i][j] + A[i]);
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        }
    }
    if(dp[M][state-1] == INF) cout << -1 << endl;
    else cout << dp[M][state-1] << endl;
    return 0;
}

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

using namespace std;

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

	if (S.length() == 3) {
		reverse(S.begin(), S.end());
		cout << S << endl;
	}
	else {
		cout << S << endl;
	}
}


Measured memory_bytes: 3588
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    a / gcd(a,b) * b;
}
const ll mod = 1e9 + 7;

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

const ll INF = 1e9;
/////////////////////////////////////////////////////////////////////////////////////////
int main(){
    int h,w;
    cin >> h >> w;
    char field[100][100];
    int dist[100][100];
    int black = 0;
    for (int i = 0;i < h;i++){
        for (int j = 0;j < w;j++){
            cin >> field[i][j];
            if (field[i][j] == '#') black++;
        }
    }
    memset(dist,-1,sizeof(dist));

    queue<pair<int,int>> que;
    que.push(make_pair(0,0));
    dist[0][0] = 0;
    int ans = 0;
    while(!que.empty()){
        pair<int,int> p = que.front();
        que.pop();

        int y = p.first,x = p.second;

        for (int i = 0;i < 4;i++){
            int ny = y + dy[i],nx = x + dx[i];
            if (ny >= 0 && ny < h && nx >= 0 && nx < w){
                if (field[ny][nx] != '#' && dist[ny][nx] == -1){
                    que.push(make_pair(ny,nx));
                    dist[ny][nx] = dist[y][x] + 1;
                }
            }
        }
    }

    if (dist[h-1][w-1] == -1) cout << -1 << endl;
    else cout << h*w - (dist[h-1][w-1] + 1) - black << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int max(int a,int b,int c){
	if(a>=b){
		if(a>=c) return a;
		else return c;
	}else{
		if(b>=c) return b;
		else return c;
	}
}

int main(void) {
	
	int N;
	scanf("%d",&N);
	int move[N][3];
	for(int i=0;i<N;i++) scanf("%d%d%d",&move[i][0],&move[i][1],&move[i][2]);
	int dp[N][3];
	
	dp[0][0] = move[0][0];
	dp[0][1] = move[0][1];
	dp[0][2] = move[0][2];
	
	for(int i=1;i<N;i++){
		for(int m=0;m<3;m++){
		dp[i][m] = move[i][m] + max(dp[i-1][(m+1)%3],dp[i-1][(m+2)%3],0);
		}
	}
	
	printf("%d",max(dp[N-1][0],dp[N-1][1],dp[N-1][2]));

    /*for(int i=0;i<N;i++){
    	for(int m=0;m<3;m++){
    		printf("%2d ",dp[i][m]);
    	}
    	printf("\n");
    }*/
	
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> P;

int main() {
    int A, B;
    cin >> A >> B;
    
    int ans;
    
    ans = max(A+B, max(A-B, A*B));
    
    cout << ans << endl;
    
}

Measured memory_bytes: 256
import java.util.*;

/**
 * AOJ #0105: Book Index (PCK 2005)
 */
public class Main {
    public static void main(String[] arg) {
        Scanner scanner = new Scanner(System.in);
        ReferenceSet refs = new ReferenceSet();
        while (scanner.hasNext()) {
            String word = scanner.next();
            int    page = scanner.nextInt();
            refs.add(word, page);
        }
        for (String word : refs.keySet()) {
            System.out.println(word);
            System.out.println(join(refs.get(word)));
        }
    }

    static String join(Iterable<?> set) {
        StringBuilder str = new StringBuilder();
        for (Object x : set) {
            if (str.length() > 0) { str.append(' '); }
            str.append(x);
        }
        return str.toString();
    }

    static class ReferenceSet extends TreeMap<String, SortedSet<Integer>> {
        public void add(String word, int page) {
            SortedSet<Integer> set = this.get(word);
            if (set == null) {
                set = new TreeSet<Integer>();
                this.put(word, set);
            }
            set.add(page);
        }
    }
}

Measured memory_bytes: 20392
while True:
    n, m, k = (int(s) for s in input().split())
    if (n, m, k) == (0, 0, 0):
        break

    t_out = [0.] * (k + m + 1)
    tl_east = [0.] * (k + m + 1)
    tl_west = [0.] * (k + m + 1)

    for i in range(n):
        xi, li, fi, di, udi = (int(s) for s in input().split())
        if not udi:
            tl_east[xi] = li / fi
            tl_west[xi] = li / di
            t_out[xi] = -tl_west[xi]
        else:
            tl_east[xi] = li / di
            tl_west[xi] = li / fi

    for i in range(m):
        vi = int(input())
        t_out[0] = max(t_out[1] - tl_east[1], i / vi)
        for j in range(1, k + m):
            t_out[j] = tl_east[j] + max(t_out[j - 1] + 1 / vi,
                                        t_out[j] + tl_west[j],
                                        t_out[j + 1] - tl_east[j + 1])

    print(t_out[k])

Measured memory_bytes: 6780
<?php
while (strlen($line=trim(fgets(STDIN)))>0) {
    $stdin[] = trim($line);
}
foreach ($stdin as $key => $value) {
    $array[] = explode(" ", $value);
}
foreach ($array[2] as $key => $value) {
    $pt[] = abs(($array[1][0] - ($value * 0.006)) - $array[1][1]);
}
echo implode(array_keys($pt, min($pt))) + 1 . "\n";

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
typedef long long ll;
typedef pair<int, int> P;
typedef struct{
  int i;
  int j;
}Coo;
typedef struct{
  Coo from;
  Coo to;
}Move;
typedef struct{
  int first;
  int second;
  int third;
}T;

//昇順
bool comp_Se(T& l, T& r){
  return l.second < r.second;
}

int W,H;

Coo next_coo(int i, int j){
  if(i%2){
    if(j==0) i++;
    else j--;
  }else{
    if(j==W-1)i++;
    else j++;
  }
  return {i,j};
}

int main(void){
  int i,j;
  cin >> H >> W;
  vector<vector<int> > v(H,vector<int>(W,0));
  vector<Move> move;
  REP(i,H){
    REP(j,W){
      int x;
      cin >> x;
      if(x%2)v[i][j] = 1;
    }
  }
  Coo cur = {0,0};
  while(true){
    i = cur.i,j=cur.j;
    Coo next = next_coo(i,j);
    if(next.i == H)break;
    if(v[i][j]%2){
      v[i][j] = 0;
      v[next.i][next.j]+=1;
      move.push_back({cur,next});
    } 
    cur = next;
  }
  cout << move.size() << endl;
  REP(i,move.size()) cout << move[i].from.i+1 << " " << move[i].from.j+1 << " " << move[i].to.i+1 << " " << move[i].to.j+1 << endl;
  return 0;
}


Measured memory_bytes: 5232
#include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
 
int main() {
  int T,D,tA,tB,dA,dB;
  scanf("%d %d %d %d %d %d",&T,&D,&tA,&tB,&dA,&dB);
  double dTemp = 999999999999.9;
  for(int i = 0; i < 10000; i++) {
    for(int j = 0; j < 10000; j++) {
      if(i == 0 && j == 0) continue;
      if(dA * i + dB * j > D) break;
      int vA = dA * i;
      int vB = dB * j;
      dTemp = min(fabs(T - ((double)tA * vA + (double)tB * vB) / (double)(vA + vB)),dTemp);
    }
  }
  printf("%.20f\n",dTemp);
}


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

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	int n;int a[10000]={};
	cin>>n;
	int sum = 0;
	rep(i, n){
		int b;
		cin >> b;
		rep(j, 100000){
			if(b % 2 == 0){
				sum++;
				b /= 2;
			}else{
				break;
			}
		}
	}
	cout << sum << endl;
	
	return 0;
}


Measured memory_bytes: 256
def main():
    import sys

    MOD = 1000000007
    N, *A = map(int, sys.stdin.buffer.read().split())
    C = [0] * (N + 1)
    C[0] = 3
    ans = 1
    for a in A:
        ans = ans * C[a] % MOD
        C[a] -= 1
        C[a + 1] += 1

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 12408
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define f(t) for(ll i =0;i<t;i++)
#define ll long long int
#define ul unsigned long int
#define ld long double
#define umpi unordered_map<int,int> 
#define umpl unordered_map<ll,ll> 
#define vi vector<int>
#define vl vector<ll>
#define vvl vector<vl>
#define fill(a,p) memset(a,p,sizeof(a))
#define pb push_back
#define mod 1000000007
#define N 100005
#define all(a) a.begin(),a.end()
#define point pair<ll,ll>
#define endl "\n"

const int inf = 1000000007;
const ll linf = 1ll * inf * inf;
const ll MAXIMUM =2005;

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c >= mod) c -= mod; return c; }
inline ll max(ll a, ll b){return a>b?a:b;}
inline ll min(ll a, ll b){return a<b?a:b;}
inline ll ceil(ll a,ll b){if(a%b==0)return a/b;else return a/b+1;}
inline ll mo(ll a,ll b){if(b<0){b=abs(b)%mod;b=a-b;return (b<0)?b+mod:b;}else{return (a+b)%mod;}}
inline ll pow(ll a,ll b){if(b==0){return 1;}else{if(b%2==0){ll temp=pow(a,b/2);return temp*temp;}
else{return a*pow(a,b-1);}}}

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

int main()
{
    ll x,n;cin>>x>>n;
    vl a(n);
    f(n)cin>>a[i];
    set<ll> s;
    f(n){
        s.insert(a[i]);
    }
    ll ans,m=inf;
    for(ll i=-1000;i<=1000;i++){
        if(s.find(i)==s.end()){
            if(abs(x-i)<m){
                m=abs(x-i);
                ans=i;
            }
        }
    }
    cout<<ans<<endl;
}

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

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

using namespace std;

class mint{
	static const int MOD=1e9+7;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }
	mint operator-()const{ return mint(-x); }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint operator+(long long x,const mint& m){ return mint(x)+m; }
mint operator-(long long x,const mint& m){ return mint(x)-m; }
mint operator*(long long x,const mint& m){ return mint(x)*m; }
mint operator/(long long x,const mint& m){ return mint(x)/m; }

mint pow(mint m,long long k){
	mint res=1;
	for(;k>0;k>>=1,m*=m) if(k&1) res*=m;
	return res;
}

mint fact(int n){
	static vector<mint> memo={1};
	if(memo.size()<=n){
		int k=memo.size();
		memo.resize(n+1);
		for(;k<=n;k++) memo[k]=memo[k-1]*k;
	}
	return memo[n];
}

mint fact_inverse(int n){
	static vector<mint> memo={1};
	if(memo.size()<=n){
		int k=memo.size();
		memo.resize(n+1);
		memo[n]=inverse(fact(n));
		for(int i=n;i>k;i--) memo[i-1]=memo[i]*i;
	}
	return memo[n];
}

mint choose(int n,int k,int type=0){
	if(k==0) return 1;
	if(n< k) return 0;
	if(type==0){
		return fact(n)*fact_inverse(k)*fact_inverse(n-k);
	}
	else{
		if(k>n-k) k=n-k;
		mint res=fact_inverse(k);
		rep(i,k) res*=n-i;
		return res;
	}
}

int main(){
	int k;
	string s; cin>>k>>s;
	int n=s.length();

	mint ans=pow(mint(26),n+k);
	rep(i,n) ans-=choose(n+k,i)*pow(mint(25),n+k-i);
	cout<<ans<<'\n';

	return 0;
}


Measured memory_bytes: 27664
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<int(n);i++)
#define FOR(i,n,m) for(int i=n;i<int(m);i++)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}	

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int N_MAX=100010;

int main(){
	ll n;
	ll ans;
	cin>>n;
	if(n%2==0)ans = (n/2) * (n-1);
	else ans = ((n-1)/2) * n;
	cout<<ans<<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);
		int str1 = sc.nextInt();
		int str2 = sc.nextInt();
		int str3 = sc.nextInt();
		
		if(str2 - str1 == str3 - str2){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
	  }
	}

Measured memory_bytes: 23124
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        String s = scan.next();
        boolean b = true;
        for(int i = 0; i < s.length(); i++){
            if(i % 2 == 0 && b){
                if(s.charAt(i) == 'R' || s.charAt(i) == 'U' || s.charAt(i) == 'D'){
                    b = true;
                }else{
                    b = false;
                }
            }else if(b){
                if(s.charAt(i) == 'L' || s.charAt(i) == 'U' || s.charAt(i) == 'D'){
                    b = true;
                }else{
                    b = false;
                }
            }
        }
        if(b){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 24148
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const ll INF = 1e18;
ll dp[20001][256];

int main() {
    int n, m;
    while (cin >> n >> m && n){
        VI c(m), x(n);
        REP(i,m) cin >> c[i];
        REP(i,n) cin >> x[i];
        REP(i,n+1) REP(j,256) dp[i][j] = INF;
        dp[0][128] = 0;
        REP(i,n) REP(j,256){
            REP(k,m){
                int a = j + c[k];
                a = max(0, min(255, a));
                dp[i+1][a] = min(dp[i+1][a], dp[i][j]+(x[i]-a)*(x[i]-a));
            }
        }
        ll ans = INF;
        REP(j,256) ans = min(ans, dp[n][j]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 43088
#include<stdio.h>

int main(void){
	int a,b,c,k;

	scanf("%d %d %d %d",&a,&b,&c,&k);
	//2 1 1 3
	int ten=0;
	if(k >= a){
		ten=a; k=k-a;
		if(k >= b){
			k=k-b;
			if(k >= c){
				ten=ten-c;
				k=k-c;
			}else{
				ten=ten-k;
			}
		}else{
		}
	}else{
		ten=k;
	}
	printf("%d",ten);

	return 0;
}


Measured memory_bytes: 1736
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.container : DList;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto list = new LinkedList();
    int q = readint;
    for (int i = 0; i < q; i++) {
        auto qu = readints;
        switch (qu[0]) {
        case 0: // insert
            list.insert(qu[1]);
            break;
        case 1: // move
            if (qu[1] >= 0)
                list.moveNext(qu[1]);
            else
                list.movePrev(-qu[1]);
            break;

        case 2: // erase
            list.erase();
            break;
        default: break;
        }
    }

    list.dump();
}

class Node {
    int value;
    Node next;
    Node prev;

    this(int value) {
        this.value = value;
    }
}

class LinkedList {
    private Node _sentinel;
    private Node _cursor;

    this() {
        _sentinel = new Node(int.max);
        _cursor = _sentinel;
    }

    // カーソル位置の直前に新しい要素を追加する。カーソルはその要素を指す
    void insert(int value) {
        auto x = new Node(value);
        auto prev = _cursor.prev;
        if (prev !is null) {
            prev.next = x;
            x.prev = prev;
        }

        _cursor.prev = x;
        x.next = _cursor;
        _cursor = x;
    }

    // カーソルを d だけ進める
    void moveNext(int d) {
        for (int i = 0; i < d; i++) {
            _cursor = _cursor.next;
        }
    }

    // カーソルを d だけ戻す
    void movePrev(int d) {
        for (int i = 0; i < d; i++) {
            _cursor = _cursor.prev;
        }
    }

    // カーソル位置の要素を消す
    void erase() {
        auto prev = _cursor.prev;
        auto next = _cursor.next;
        if (prev !is null)
            prev.next = next;
        next.prev = prev;
        _cursor = next;
    }

    void dump() {
        auto x = _cursor;
        while (x.prev !is null) x = x.prev;
        while (x !is _sentinel) {
            writeln(x.value);
            x = x.next;
        }
    }
}



Measured memory_bytes: 56172
#include <bits/stdc++.h>
using  namespace  std;
using ll=long long;
int main(){
string s,t;
cin>>s>>t;
sort(s.begin(),s.end());
sort(t.begin(),t.end(),greater<char>());
bool flag=false;
if(s.size()<t.size())flag=true;
for(int i=0;i<min(s.size(),t.size());i++){
  if(s.at(i)<t.at(i)){
  flag=true;
  break;
  }
  if(s.at(i)>t.at(i)){
    flag=false;
  break;
  }
  }
  if(flag)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
A = list(map(int,input().split()))
ng = 0
ok = max(A)

def queri(n):
    count = 0
    for i in A:
        count += -(-i//n)-1
    if k>= count:
        return True
    else:
        return False

while ok - ng > 1:
    mid = (ok+ng)//2
    if queri(mid) :
        ok = mid
    else:
        ng = mid
print(ok)

Measured memory_bytes: 30792
fun main(){
    val N = readLine()?.toInt()
    var ret: Long = 0

    for(i in 1..N!!){
        if(i%3!=0 && i%5!= 0) ret += i
    }
    print(ret)
//1000000→266666333332が正解。378360980になる。なんで。
}

Measured memory_bytes: 34528
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <cassert>

using namespace std;

const int mod = 1000000007;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n;
    string s;
    cin >> s;
    if (s.size() < 4 || s[0] != 'Y' || s[1] != 'A' || s[2] != 'K' || s[3] != 'I')
        cout << "No";
    else
        cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    friend std::istream &operator>>(std::istream &in, mint &o) {
        ll a;
        in >> a;
        o = a;
        return in;
    }

    friend std::ostream &operator<<(std::ostream &out, const mint &o) {
        out << o.x;
        return out;
    }

};

struct combination {
    vector<mint> fact, ifact;

    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }

    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} combination(1000000);

int main() {
    int n;
    cin >> n;
    if (n < 2) {
        cout << 0 << endl;
        ret();
    }
    mint ans = 0;
    for (int e = 2; e <= n; e++) {
        mint ex = mint(2).pow(e) - 2;
        mint c = combination(n, e);
        mint f = mint(8).pow(n - e);
        mint now = ex * c * f;
        ans += now;
    }
    cout << ans << endl;
}


Measured memory_bytes: 18620
#include <iostream>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
constexpr int MAX=510000;

ll fact[MAX], fact_inv[MAX];

// 繰り返し二乗法
ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

ll comb(ll n, ll r){
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n=100000;
	// cin>>n;
	fact[0]=1;
        // 階乗の計算
	REP(i, n) fact[i+1]=fact[i]*(i+1)%MOD;
	fact_inv[n]=power(fact[n], MOD-2);
        // 逆元の計算
	FORR(i, 0, n) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
        // nCrの計算
        //cout<<"2000C3: "<<comb(2000, 3)<<'\n';
        //cout<<"666C390: "<<comb(666, 390)<<'\n';

    /**/
    long long s, ans = 0;
    cin >> s;

    int kosu = s/3;

    for(int i = kosu;i >= 1;i--){
        long long toubun = i;
        long long warareru = s - i*3;
        long long x = comb(warareru + toubun - 1, toubun - 1);
        //printf("%lldを%lld個わる方法　%lld通り\n", warareru, toubun, x);
        ans += x;
        ans %= MOD;
    }

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

Measured memory_bytes: 4756
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

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

int dp[2][2][101][101];

int main() {
	while (true) {
		int w, h;
		cin >> w >> h;
		if (w == 0 && h == 0) break;

		memset(dp, 0, sizeof(dp));

		dp[0][0][1][0] = 1;
		dp[1][0][0][1] = 1;

		REP(i, h) {
			REP(j, w) {
				dp[0][0][i + 1][j + 1] = dp[0][0][i][j + 1] + dp[0][1][i][j + 1];
				dp[0][1][i + 1][j + 1] = dp[1][0][i][j + 1];
				dp[1][0][i + 1][j + 1] = dp[1][0][i + 1][j] + dp[1][1][i + 1][j];
				dp[1][1][i + 1][j + 1] = dp[0][0][i + 1][j];

				REP(k, 2) REP(l, 2) dp[k][l][i + 1][j + 1] %= 100000;
			}
		}

		int ans = 0;
		REP(i, 2) REP(j, 2) ans += dp[i][j][h][w];
		cout << ans % 100000 << endl;
		
	}

	return 0;
}

Measured memory_bytes: 1328
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS=1e-9;



int main(void){
  string s;
  cin >> s;
  int n = s.length();
  int x = -1, y = -1;
  REP(i, 0, n - 1) {
    if (s[i] == s[i + 1]) {
      x = i + 1;
      y = i + 2;
    }
  }
  REP(i, 0, n - 2) {
    int ch[26] = {0};
    REP(j, 0, 3) ch[s[i + j] - 'a']++;
    bool ok = 0;
    REP(j, 0, 26) {
      ok |= ch[j] >= 2;
    }
    if (ok) {
      x = i + 1;
      y = i + 3;
    }
  }
  cout << x << " " << y << endl;
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<long long>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define couta(x) for(auto iter : x) p(iter)
#define yes(x) x ? cout << "Yes" << endl : cout << "No" << endl;
using namespace std;
typedef long long lint;
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef vector<long long> VLL;
typedef vector<vector<int> > VVI;
typedef vector<vector<long long> > VVLL;
typedef vector<vector<bool> > VVB;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
using UnweightedGraph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
const long long INF = 2000000000ll;
const long double PI = acosl(-1);
const long double EPS = 1e-7;
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; }



long long power(long long a, long long b) {return b?power(a*a,b/2)*(b%2?a:1):1;}
long long perm(long long N, long long K){
    long long x=1;
    for(long long i=1;i<=K;i++)
    {
        x=x*(N-i+1);
    }
    return x;
}
long long factorial(long long N) {return perm(N,N);}
long long comb(long long N,long long K) {return factorial(N)/factorial(K)/factorial(N-K);}
long long hcomb(long long N, long long K) {return comb(N+K-1, N-1);}

int dtoi(double d) {return round(d);}

bool isprime(int n) {
    if (n < 2) return false;
    for (int i = 2; i*i <= n; ++i) {
        if (n % i ==  0) return false;
    }
    return true;
}

long long mystoll(string s){
    long long ans = 0;
    for (int i = (int) s.length()-1; i >= 0; i--){
        ans += (s[i]-'0') * power(10,s.length()-1-i);
    }
    return ans;
}

template<class T>
long long SUM(T a) {
    long long sum = 0;
    for(auto itr : a) sum += itr;
    return sum;
}

void solve(int64_t R) {
    p((LD)2*PI*R);
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int64_t R;
    cin >> R;
    solve(R);
    return 0;
}


Measured memory_bytes: 3868
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;

int dp[41][401][401];

int main(void) {

  int n, a[40], b[40], c[40], ma, mb;
  cin >> n >> ma >> mb;
  rep(i, n) cin >> a[i] >> b[i] >> c[i];

  int A = 0, B = 0;
  rep(i, n) A += a[i], B += b[i];

  int k = min(A/ma, B/mb);

  rep(i, k*ma + 1) rep(j, k*mb + 1) dp[0][i][j] = INT_MAX;
  dp[0][0][0] = 0;

  for (int i = 1; i <= n; i++) {
    for (int x = 0; x <= k*ma; x++) {
      for (int y = 0; y <= k*mb; y++) {
	dp[i][x][y] = dp[i-1][x][y];
	if (x >= a[i-1] && y >= b[i-1] && dp[i-1][x-a[i-1]][y-b[i-1]] != INT_MAX) {
	  dp[i][x][y] = min(dp[i][x][y], dp[i-1][x-a[i-1]][y-b[i-1]] + c[i-1]);
	}
      }
    }
  }

  int ans = INT_MAX;
  for (int i = 1; i <= k; i++) {
    ans = min(ans, dp[n][i*ma][i*mb]);
  }

  if (ans == INT_MAX) cout << -1 << endl;
  else cout << ans << endl;

  return 0;

}


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

int main(){
   int n;
   cin >> n;
   int b;
   int min=1000000;
   int bs,as,a1,b1;
   for (int a=1;a<=n/2;a++) {
      a1=a;
      b1=n-a;
      bs=0;
      as=0;
      while (a1){
         as+=a1%10;
         a1/=10;
      }
      while (b1){
         bs+=b1%10;
         b1/=10;
      }
      if (min>bs+as)min=bs+as;
   }
   cout << min << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
typedef pair<int, bool> sP;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

int n;

bool b[200][200];
int col[200];
bool used[200];
void solve() {
	cin >> n;
	vector<string> s(n);
	rep(i, n) {
		cin >> s[i];
		rep(j, n) {
			if (s[i][j] == '1')b[i][j] = true;
		}
	}
	queue<int> q; q.push(0);
	used[0] = true;
	while (!q.empty()) {
		int id = q.front(); q.pop();
		rep(j, n)if (b[id][j]) {
			if (used[j]) {
				if (col[j] != col[id] ^ 1) {
					cout << -1 << endl; return;
				}
			}
			else {
				used[j] = true;
				col[j] = col[id] ^ 1;
				q.push(j);
			}
		}
	}
	int ans = 0;
	rep(i, n) {
		q.push(i);
		fill(used, used + n, false);
		used[i] = true;
		int tmp = 0;
		while (!q.empty()) {
			int len = q.size();
			rep(aa, len) {
				int id = q.front(); q.pop();
				rep(j, n)if (b[id][j]) {
					if (!used[j]) {
						used[j] = true;
						q.push(j);
					}
				}
			}
			tmp++;
		}
		ans = max(ans, tmp);
	}
	cout << ans << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init();
	solve();
	//stop
	return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <math.h>
using namespace std;

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

	string S;
	cin >> S >> K;

	char kChar = S[K - 1];

	for (int i = 0; i < N; ++i)
	{
		if (S[i] != kChar)
		{
			S[i] = '*';
		}
	}

	cout << S << endl;

	return 0;
}

Measured memory_bytes: 256
n, T = [int(i) for i in input().split()]
INF = 10000

mc = INF
for i in range(n):
    c, t = [int(k) for k in input().split()]
    if c < mc and t <= T:
        mc = c

if mc == INF:
    print('TLE')
else:
    print(mc)


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

int main() {
	int n, max = 0, sum = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a > max) max = a;
		sum += a;
	}

	sum -= max;

	if (max < sum) cout << "Yes"; else cout << "No";

	getchar(); getchar();
	return 0;
}


Measured memory_bytes: 256