akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>
#include <type_traits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//constexpr long long MOD = 1e9 + 7;
//constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;
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; }

ll h, w;
vector<ll> dx = { -1, 0, 1, 0 };
vector<ll> dy = { 0, -1, 0, 1 };


bool isInField(ll x, ll y) {
    bool f = x >= 0 && x < w && y >= 0 && y < h;
    return f;
}

bool compare_first(pair<ll, ll> x, pair<ll, ll> y)
{
    if (x.first != y.first) {
        return x.first < y.first;
    }
    else {
        return x.second < y.second;
    }
}

bool compare_second(pair<ll, ll> x, pair<ll, ll> y)
{
    if (x.second != y.second) {
        return x.second < y.second;
    }
    else {
        return x.first < y.first;
    }
}

struct {
    bool operator()(pair<string, int> x, pair<string, int> y) const
    {
        return x.second <= y.second && x.first < y.first;
    }
} compare_map;

const ll MAX = 500000000;
const ll MOD = 1000000007;

vector<ll> dijkstra(const vector<vector<pair<ll, ll>>>& graph, int start) {
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;
    vector<ll> dist(graph.size(), INF);
    dist[start] = 0l;
    pq.push(pair<ll, ll>(dist[start], start));
    while (!pq.empty()) {
        auto p = pq.top();
        pq.pop();
        int d = p.first;
        int from = p.second;
        if (dist[from] < d) continue;
        for (auto next : graph[from]) {
            int to = next.first;
            int cost = next.second;
            if (dist[from] + cost < dist[to]) {
                dist[to] = dist[from] + cost;
                pq.push(pair<ll, ll>(dist[to], to));
            }
        }
    }
    return dist;
}


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

    int n;
    cin >> n;

    if (n % 2 == 0) {
        cout << n / 2 << "\n";
    }
    else {
        cout << n / 2 + 1 << "\n";
    }
    return 0;
}



Measured memory_bytes: 256
import sys
from collections import deque
input = sys.stdin.readline

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10**9

def dfs(cur, a, b, c):
    if cur == N:
        if min(a, b, c) > 0:
            return abs(a-A) + abs(b-B) + abs(c-C) - 30 #最初の三回
        else:
            return INF #長さ0になった場合
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3316
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
s=input()
h=0
for i in range(n-1):
  if s[0] == "L":
    pass
  if s[i] == s[i+1]:
    h += 1
print(min(h+2*k,n-1))


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

int main() {
  int N;
  cin >> N;
  int M = N % 10;
  if(M == 2 || M == 4  || M == 5 || M == 7 || M == 9) cout << "hon" << endl;
  else if(M == 0 || M == 1 || M == 6 || M == 8) cout << "pon" << endl;
  else cout << "bon" << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

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 RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 200010;
int M;
int d[MAX];
LL C[MAX];

unordered_map<LL, pair<LL, int>> memo[10];

pair<LL, int> calc(int digit, LL count) {
    if (memo[digit].count(count)) {
        return memo[digit][count];
    } else if (count == 1) {
        return memo[digit][count] = {0, digit};
    }

    const auto half = calc(digit, count / 2);
    LL res = half.first * 2;
    int dig = half.second * 2;
    res++;
    if (dig >= 10) {
        dig = dig / 10 + dig % 10;
        res++;
    }
    if (count % 2) {
        dig += digit;
        res++;
        if (dig >= 10) {
            dig = dig / 10 + dig % 10;
            res++;
        }
    }

    return memo[digit][count] = {res, dig};
}

int main(void) {
    cin >> M;
    REP(i, M) {
        cin >> d[i] >> C[i];
    }

    LL ans = 0;
    VI last_d;
    REP(i, M) {
        const auto res = calc(d[i], C[i]);
        ans += res.first;
        last_d.EB(res.second);
    }

    int prev = last_d[0];
    FOR(i, 1, last_d.size()) {
        prev += last_d[i];
        ans++;
        if (prev >= 10) {
            prev = prev / 10 + prev % 10;
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 209800
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,ans=0;
    cin >>n;
    int a;
    for(int i=0;i<n;i++){
        cin >>a;
        if(a%2==1 &&i%2==0)ans++;
    }
    cout <<ans;
}


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

def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

if n==1:
    print(x[0])
else:
    element = gcd(x[0], x[1])
    if n==2:print(element)
    else:
        for i in range(2,n):
            element=gcd(element,x[i])
        print(element)



Measured memory_bytes: 14228
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>

using namespace std;

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
	ll n, m;
	vll x, y;
	vll x_len, y_len;
	cin >> n >> m;
	ll i, j, k;
	x_len.push_back(0);
	y_len.push_back(0);
	for (i = 0; i < n; i++){
		ll xi;
		cin >> xi;
		x.push_back(xi);
		if (i >= 1){
			x_len.push_back(x[i] - x[i - 1]);
		}
	}
	for (j = 0; j < m; j++){
		ll yj;
		cin >> yj;
		y.push_back(yj);
		if (j >= 1){
			y_len.push_back(y[j] - y[j - 1]);
		}
	}
	ll x_sum = 0;
	for (i = 1; i < n; i++){
		k = min(i, n - i);
		ll x_sum_tmp = (k*(n - k)*x_len[i])%MOD;
		x_sum = (x_sum + x_sum_tmp)%MOD;
	}
	ll y_sum = 0;
	for (j = 1; j < m; j++){
		k = min(j, m - j);
		ll y_sum_tmp = (k*(m - k)*y_len[j]) % MOD;
		y_sum = (y_sum + y_sum_tmp) % MOD;
	}

	cout << x_sum*y_sum%MOD << endl;

}


Measured memory_bytes: 4204
import numpy as np
N = int(input())
A = list(map(int ,input().split()))
sum=0
ans=0
for i in range (0,N-1):
  sum=sum+A[i]
  sum=sum%(1000000000+7)
  ans=ans+sum*A[i+1]
  ans=ans%(1000000000+7)
print(ans)

Measured memory_bytes: 49532
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var S = Console.ReadLine();

            var counts = new List<int>();
            foreach(var val in new List<bool>() { true, false })
            {
                var theory = val;
                var count = 0;
                for (int i = 0; i < S.Length; i++)
                {
                    // 理論値と違っていれば変更が必要
                    if (theory == true && S[i] != '1' ||
                        theory == false && S[i] != '0')
                    {
                        count++;
                    }

                    theory ^= true;
                }

                counts.Add(count);
            }

            Console.WriteLine(counts.Min());
        }
    }
}


Measured memory_bytes: 13408
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const double PI  = acos(-1.0);
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const LL INF  = 0x3f3f3f3f3f3f3f3f;
const int N=3e5+10;
const int M=1e6+10;
const int mod=1e9+7;
inline LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
inline LL lcm(LL a, LL b) { return a * b / gcd(a, b); }
inline LL read(){LL x=0,f=1;char c=getchar();while(c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}return x*f;}
inline LL qpow(LL x,LL k=mod-2,LL m=mod){LL res=1;while(k){if(k&1) res=res*x%m;x=x*x%m;k>>=1;}return res;}
/*=================================================================================================================*/
int n,a[N],b[N];

int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=n;i++) scanf("%d",&b[i]);
    reverse(b+1,b+n+1);
    for(int i=1;i<=n;i++){
        if(b[i]!=a[i]) continue;
        for(int k=1;k<=n;k++) if(b[i]!=a[k]&&b[k]!=a[i])
            {swap(b[i],b[k]);break;}
        if(b[i]==a[i]) break;
    }
    for(int i=1;i<=n;i++) if(a[i]==b[i]) return printf("No\n"),0;
    printf("Yes\n");
    for(int i=1;i<=n;i++) printf("%d ",b[i]);
    return 0;
}


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

using namespace std;
const int N = 100000 + 10;
typedef long long ll;
int root[N];
int Find(int x)
{
    return x == root[x] ? x : root[x] = Find(root[x]);
}

int join(int x, int y)
{
    int a = Find(x), b = Find(y);
    if(a != b)
    {
        root[a] = b;
        return 1;
    }
    return 0;
}
struct node
{
    int x, y, w;
}p[N];

int cmp1(node a, node b)
{
    return a.x < b.x;
}

int cmp2(node a, node b)
{
    return a.y < b.y;
}
typedef pair<int, int> P;
vector<pair<int, P> > path;
int main()
{
    int n;
    scanf("%d", &n);
    for(int i = 0; i<n; i++)
        scanf("%d%d", &p[i].x, &p[i].y), p[i].w = i, root[i] = i;
    sort(p, p+n, cmp1);
    for(int i = 1; i<n; i++)
    {
        int x = p[i].w;
        int y = p[i-1].w;
        int z = abs(p[i].x - p[i-1].x);
        path.push_back(make_pair(z, make_pair(x, y)));
    }

    sort(p, p+n, cmp2);
    for(int i = 1; i<n; i++)
    {
        int x = p[i].w;
        int y = p[i-1].w;
        int z = abs(p[i].y - p[i-1].y);
        path.push_back(make_pair(z, make_pair(x, y)));
    }
    sort(path.begin(), path.end());
    int ans = 0;
    for(int i = 0; i<path.size(); i++)
    {
        if(join(path[i].second.second, path[i].second.first))
           ans += path[i].first;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6644
#include<stdio.h>
int main(void)
{
	int S,h,m,s;
	scanf("%d",&S);
	h=S/3600;
	S=S%3600;
	m=S/60;
	s=S%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}


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

int main() {
  map<string, vector<int> > M;
  string in;
  int page;
  while(cin>>in>>page) {
    if(M.find(in) == M.end())
      M[in] = vector<int>(1, page);
    else
      M[in].push_back(page);
  }

  map<string, vector<int> >::iterator it = M.begin();
  while(it != M.end()) {
    cout<<(*it).first<<endl;
    sort((*it).second.begin(), (*it).second.end());
    for(int i=0; i<(*it).second.size()-1; ++i)
      cout<<(*it).second[i]<<" ";
    cout<<(*it).second[(*it).second.size()-1]<<endl;
    it++;
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

template<typename T>
T gcd(T a, T b) {
    if(b == 0){
        return a;
    }else if(a == 0){
        return b;
    }else{
        return gcd(b, a % b);
    }
}

template<typename T>
T lcm(T a,T b){
    if(a == 0||b == 0){
        return 0;
    }else{
        return (a/gcd(b, a % b))*b;
    }
}
int main(){

    int n,k;
    cin>>n>>k;
    vector<long long int> v(n);
    REP(i,n){
        cin >> v[i];
        if(v[i]==k){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    sort(v.begin(), v.end());
    long long int GCD = v[0];
    FOR(i,1,n){
        GCD = gcd(GCD, v[i]);
    }
    if(k%GCD==0&&k<v[n-1]){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
char ss[110];
int main()
{
	cin>>ss;
	int len=strlen(ss);
	bool f=true;
	for(int i=0;i<len;i++)
	{
		char tmp=ss[i];
		if(i%2==1)
		{
			if(tmp!='L'&&tmp!='U'&&tmp!='D')
			{
				f=false;
				break;
			}
			
		}
		else
		{
				if(tmp!='R'&&tmp!='U'&&tmp!='D')
			{
				f=false;
				break;
			}
			
		}
	}
	if(f)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
	
 } 

Measured memory_bytes: 256
/* おまじない　*/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
typedef long long ll;
typedef long double ld;
using namespace std;
const ll MOD=pow(10,9)+7;
const ll INF=(1LL<<62);
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
    cout<<fixed;
}
int main(){
    init();

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

    ll ans=0;
    for(int i=1;i<N;i++){
        if(A[i-1]<A[i])ans++;
    }

    cout<<N-ans<<endl;
    cout<<N<<endl;
}


Measured memory_bytes: 3636
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var N int
	var S string
	con.Scan(&N, &S)
	x := 0
	maxx := 0
	for _, i := range S {
		if i == 'I' {
			x++
		} else {
			x--
		}
		if x > maxx {
			maxx = x
		}
	}
	con.Println(maxx)
	return nil
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;

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


long long solution(vector<pair<long long, long long>>& M, long long D, long long A){
    int N = M.size();
    // 左から見ていくために、座標の昇順でソート
    sort(M.begin(), M.end());

    long long ans = 0, carry = 0;
    queue<pair<long long, long long>> q;
    REP(i, N){
        long long X = M[i].first;
        long long H = M[i].second;
        // これまでの操作の範囲に含まれないものの効果を取り除く
        while(!q.empty() and q.front().first < X){
            carry -= A*q.front().second;
            q.pop();
        }
        H -= carry;
        if(H > 0){
            long long num = (H+A-1)/A;
            ans += num;
            carry += A*num;
            q.emplace(X+2*D, num);
        }
    }
    return ans;
}


/* Binary Indexed Tree (Fenwick Tree)
 * 数列 {v_n} に対して、
 * ・ v[i] += w
 * ・ sum(l,r) = v[l+1]+...+v[r]
 * の操作を O(logN) でしたいって時に使える
 * cf. http://hos.ac/slides/20140319_bit.pdf
 * 1-index と 0-index を使い分けること！ (0-index の実装怪しい)
 */
template <typename T=long long>
class BIT  
{
    private:
        int sz;  // 1, 2, ..., sz の index を管理
        vector<T> bit;  // BIT を保存する vector; 区間の右端で番号付け

    public:
        BIT(int N): sz(N), bit(N+1, 0) {};

        // v[idx] に w を足す
        void add(int idx, T w){
            // x&(-x) で x の最も下の立っているbit (=各BITが管理する長さ) が取り出せる
            // 自分の番号に自分の長さを足していくと自分が含まれている領域を全て尽くせる
            for(int x = idx; x <= sz; x += x&(-x)) bit[x] += w;  // 1-index
            // for(int x = idx; x < sz; x |= x+1) bit[x] += w;  // 0-index
        }

        // v[1]+...+v[idx] を返す
        T sum(int idx){
            T ret = 0;
            // 区間和は、自分の番号から自分の区間の長さを引くと求まる
            for(int x = idx; x > 0; x -= x&(-x)) ret += bit[x];  // 1-index
            //for(int x = idx-1; x >= 0; x = (x&(x+1))-1) ret += bit[x];  // 0-index
            return ret;
        }
        
        // v[left+1]+...+v[right] を返す
        T sum(T left, T right){ return sum(right)-sum(left); }
};

long long solutionWithBIT(vector<pair<long long, long long>>& M, long long D, long long A){
    int N = M.size();
    sort(M.begin(), M.end());
    long long ans = 0;
    BIT<long long> bit(N+1);
    REP(i, N){
        long long X = M[i].first;
        long long H = M[i].second;

        H -= A*bit.sum(i+1);
        if(H <= 0) continue;
        long long num = (H+A-1)/A;
        ans += num;
        bit.add(i+1, num);
        int j = distance(M.begin(), lower_bound(M.begin(), M.end(), make_pair(X+2*D+1, (long long) -1)));
        bit.add(j+1, -num);
    }
    return ans;
}

int main()
{
    int N, D, A;
    cin >> N >> D >> A;
    vector<pair<long long, long long>> M(N);
    REP(i, N) cin >> M[i].first >> M[i].second;

    cout << solutionWithBIT(M, D, A) << endl;

    return 0;
}

Measured memory_bytes: 4992
def result(n, a, b)
  new_array = Array.new
  n.times do |i|
    new_array.push([a[i],b[i]])
  end

  new_array.sort_by!(&:last).reverse
  # p new_array

  count = 0
  flg = true
  new_array.each do |item|
    count += item[0]
    if(count > item[1])
      flg = false
      break
    end
  end
  puts flg ? "Yes" : "No"
end

N = gets.to_i
A, B = N.times.map{gets.split.map(&:to_i)}.transpose

result(N, A, B)


Measured memory_bytes: 31664
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		String s = in.next();
        int n =  s.length();
        int count = 0;
        int max = 0;
		char[] s_c = s.toCharArray();
      
      for(int i = 0;i < n ;i++){
       if(s_c[i]=='A'||s_c[i]=='C'||s_c[i]=='G'||s_c[i]=='T'){
         count++;
       }else{
        count = 0;
       }
        max = Math.max(max,count);
      }
      
      System.out.print(max);
	}
}

Measured memory_bytes: 23636
#include <stdio.h>

main(){
    int N,M;
    long long cake[1000][8];
    long long x,y,z;
    int hoge[3][8]={
        {1, 1, 1, 1,-1,-1,-1,-1},
        {1, 1,-1,-1, 1, 1,-1,-1},
        {1,-1, 1,-1, 1,-1, 1,-1}
    };
    int i,j,k;
    scanf("%d %d",&N,&M);
    for(i=0;i<N;i++){
        scanf("%lld %lld %lld",&x,&y,&z);
        for(j=0;j<8;j++)
            cake[i][j]=x*hoge[0][j]+y*hoge[1][j]+z*hoge[2][j];
    }
    long long max[8]={0,};
    long long tmax;
    int tk;
    for(i=0;i<8;i++)
        for(j=0;j<M;j++){
            tmax=-1e18;
            for(k=0;k<N;k++)
                if(tmax<cake[k][i]){
                    tmax=cake[k][i];
                    tk=k;
                }
            max[i]+=cake[tk][i];
            cake[tk][i]=-1e18;
        }
    tmax=-1e18;
    for(i=0;i<8;i++){
        if(tmax<max[i])
            tmax=max[i];
    }
    printf("%lld\n",tmax);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
const ll MODA=998244353;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        swap(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
vector<ll> find_divisor(ll N){
  ll k=1;
  while(k*k<=N){
    k++;
  }
  vector<ll> A(1);
  rep(i,k){
    if(i==1)A.at(0)=1;
    else if(i>=2){
      if(N%i==0)A.push_back(i);
    }
  }
  ll t=0;
  t=A.size();
  rep(i,t){
    if(A.at(t-i-1)*A.at(t-i-1)!=N)A.push_back(N/A.at(t-1-i));
  }
  return A;
}
vector<ll> fac;
vector<ll> finv;
vector<ll> inv;
void COMinit(ll N,ll P){
    rep(i,N+1){
        if(i==0){
            fac.push_back(1);
            finv.push_back(1);
            inv.push_back(1);
        }
        else if(i==1){
            fac.push_back(1);
            finv.push_back(1);
            inv.push_back(1);
        }
        else{
            fac.push_back(fac.at(i-1)*i%P);
            inv.push_back(P-inv.at(P%i)*(P/i)%P);
            finv.push_back(finv.at(i-1)*inv.at(i)%P);
        }
    }
}

ll COM(ll n,ll k,ll P){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac.at(n)*(finv.at(k)*finv.at(n-k)%P)%P;
}
int main()
{
    ld pi=3.141592653589793;
    ld A,B,H,W;
    cin>>A>>B>>H>>W;
    ld angleA,angleB;
    angleA=30*H+W/2;
    angleB=6*W;
    ld angle;
    angle=abs(angleA-angleB);
    angle=min(angle,360-angle);
    cout<<setprecision(15)<<sqrt(A*A+B*B-2*A*B*cos(angle*pi/180))<<endl;
}

Measured memory_bytes: 4160
//Code is taken from geeksforgeeks it's not written on my own :)

// C++ code to find number of distinct numbers 
// in a subarray 
#include<bits/stdc++.h> 
using namespace std; 

const int MAX = 1000001; 

// structure to store queries 
struct Query 
{ 
	int l, r, idx; 
}; 

// cmp function to sort queries according to r 
bool cmp(Query x, Query y) 
{ 
	return x.r < y.r; 
} 

// updating the bit array 
void update(int idx, int val, int bit[], int n) 
{ 
	for (; idx <= n; idx += idx&-idx) 
		bit[idx] += val; 
} 

// querying the bit array 
int query(int idx, int bit[], int n) 
{ 
	int sum = 0; 
	for (; idx>0; idx-=idx&-idx) 
		sum += bit[idx]; 
	return sum; 
} 

void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
	// initialising bit array 
	int bit[n+1]; 
	memset(bit, 0, sizeof(bit)); 

	// holds the rightmost index of any number 
	// as numbers of a[i] are less than or equal to 10^6 
	int last_visit[MAX]; 
	memset(last_visit, -1, sizeof(last_visit)); 

	// answer for each query 
	int ans[q]; 
	int query_counter = 0; 
	for (int i=0; i<n; i++) 
	{ 
		// If last visit is not -1 update -1 at the 
		// idx equal to last_visit[arr[i]] 
		if (last_visit[arr[i]] !=-1) 
			update (last_visit[arr[i]] + 1, -1, bit, n); 

		// Setting last_visit[arr[i]] as i and updating 
		// the bit array accordingly 
		last_visit[arr[i]] = i; 
		update(i + 1, 1, bit, n); 

		// If i is equal to r of any query store answer 
		// for that query in ans[] 
		while (query_counter < q && queries[query_counter].r == i) 
		{ 
			ans[queries[query_counter].idx] = 
					query(queries[query_counter].r + 1, bit, n)- 
					query(queries[query_counter].l, bit, n); 
			query_counter++; 
		} 
	} 

	// print answer for each query 
	for (int i=0; i<q; i++) 
		cout << ans[i] << endl; 
} 

// driver code 
int main() 
{ 
    int n,q,la,ra;
    cin>>n>>q;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    Query queries[q];
    for(int i=0;i<q;i++){
        cin>>la>>ra;
        queries[i].l = la-1; 
	queries[i].r = ra-1; 
	queries[i].idx = i;
    }
	sort(queries, queries+q, cmp); 
	answeringQueries(a, n, queries, q); 
	return 0; 
} 


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

using namespace std;

#define INF ((1LL<<31)-1)
#define D 10

struct SegTree {
	int segSize, realSegSize, nodeSize;
//	vector<int> seg;
	int *seg;

	void init(int n) {
		realSegSize = n;

		nodeSize = 0;
		for (segSize = 1; segSize < n; segSize *= D) nodeSize += segSize;

		seg = (int*)malloc(sizeof(int) * (nodeSize+segSize));
		fill(&seg[0], &seg[0]+nodeSize+segSize, INF);
//		seg = vector<int>(nodeSize+n, INF);
	}

	int get(int n) {
		return seg[n];
//		if (n < (int)seg.size()) return seg[n];
//		else return INF;
	}
	void set(int n, int v) {
		seg[n] = v;
//		if (n < (int)seg.size()) seg[n] = v;
	}

	void update(int pos, int val) {
		int n = nodeSize + pos;
		set(n, val);
		while (n) {
			n = (n-1)/D;

			int r = INF;
			for (int i = 0; i < D; ++i) {
				r = min(r, seg[n*D+i+1]);
			}
			set(n, r);
		}
	}
	int get(int n, int l, int r, int L, int R) {
//		cout << n << " " << l << " " << r << endl;
		if (L <= l && r <= R) return get(n);
		else if (R <= l || r <= L) return INF;
		else {
			int ret = INF;
			int prev = l;
			for (int i = 0; i < D; ++i) {
				int next = i == D-1 ? r : prev + (r-l)/D;
				ret = min(ret, get(n*D+i+1, prev, next, L, R));
				prev = next;
			}
			return ret;
		}
	}
	int get(int L, int R) {
		return get(0, 0, segSize, L, R);
	}

	~SegTree() {
		free(seg);
		//seg.clear();
		//seg.shrink_to_fit();
	}
};

struct Query {
	int y1, x1, y2, x2;
};

int main() {
	int H, W, Q;
	while ( cin >> H >> W >> Q, H || W || Q ) {
		int *m = (int*)malloc(sizeof(int) * W*H);
//		vector< vector<int> > m(H, vector<int>(W, 0));

		for (int y = 0; y < H; ++y) {
			for (int x = 0; x < W; ++x) {
				cin >> m[y*W+x];
			}
		}

		bool isSegRow = H < W;
		vector<SegTree> seg;

		if (isSegRow) {
			seg.resize(H);
			for (int y = 0; y < H; ++y) {
				seg[y].init(W);
			}
		}
		else {
			seg.resize(W);
			for (int x = 0; x < W; ++x) {
				seg[x].init(H);
			}
		}

		for (int y = 0; y < H; ++y) {
			for (int x = 0; x < W; ++x) {
				if (isSegRow) seg[y].update(x, m[y*W+x]);
				else seg[x].update(y, m[y*W+x]);
			}
		}

		for (int t = 0; t < Q; ++t) {
			int y1, x1, y2, x2; cin >> y1 >> x1 >> y2 >> x2;

			int ans = INF;
			if (isSegRow) {
				for (int y = y1; y <= y2; ++y) {
					ans = min(ans, seg[y].get(x1, x2+1));
				}
			}
			else {
				for (int x = x1; x <= x2; ++x) {
					ans = min(ans, seg[x].get(y1, y2+1));
				}
			}
			cout << ans << endl;
		}

		seg.clear();
		seg.shrink_to_fit();
	}
}

Measured memory_bytes: 9376
def max(a,b); a < b ? b : a; end
def min(a,b); a < b ? a : b; end

class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)

  def initialize
    @n,@k = gets.to_s.split.map{ |v| v.to_i }
    @h = Array.new(n){ gets.to_s.to_i }

    @gap = @h.sort.each_cons(2).map{ _2 - _1 }
    @cs = @gap.each_with_object([0]) { |v, h| h << h[-1] + v }
  end

  def solve
    ans = 10**12
    0.upto(n-k) do |i|
      ans = min(ans, @cs[i+k-1] - @cs[i])
    end
    ans
  end
  
  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end


Measured memory_bytes: 18196
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		String input = ""; // 入力された(H,W)を一時敵に保持しておくための変数
		String[] inputdata = new String[2]; // inputの変数を配列に保持しておくための変数
		int Max = 10000;
		int n = 0; // 入力されたデータ(H, W)の組数をカウントするための変数
		int[][] HW_data = new int[Max][2];
		boolean judge = true;
		String output1 = "#";
		String output2 = ".";

		out: for (int i = 0; i < HW_data.length; i++) {

			input = sc.nextLine();
			inputdata = input.split(" ");
			HW_data[i][0] = Integer.parseInt(inputdata[0]);
			HW_data[i][1] = Integer.parseInt(inputdata[1]);

			if ((HW_data[i][0] == 0) && (HW_data[i][1] == 0)) {
				break out;
			}

			if ((HW_data[i][0] < 3 || HW_data[i][0] > 300)
					|| (HW_data[i][1] < 3 || HW_data[i][1] > 300)) {
				judge = false;
				break out;
			}

			n++;

		}

		if (judge == true) {
			for (int i = 0; i < n; i++) {
				for (int j = 1; j <= HW_data[i][0]; j++) { // 縦H
					for (int k = 1; k <= HW_data[i][1]; k++) { // 横W

						if ((j == 1 || j == HW_data[i][0])
								|| (k == 1 || k == HW_data[i][1])) {
							System.out.print(output1);
						} else {
							System.out.print(output2);
						}
					}
					System.out.println();
				}
				System.out.println();
			}
		}

	}
}



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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

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

    string s;
    cin >> s;
    int ans = 0;
    char pre=' ';
    REP(i,n){
        if(pre!=s[i]){
            ans += 1;
        }
        pre = s[i];
    }

    cout << ans <<"\n";

    return 0;
}

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

#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,q;
    cin>>n>>m>>q;
    ll l,r,v[n+1][n+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            v[i][j]=0;
        }
    }
    for(int i=0;i<m;i++){
        cin>>l>>r;
        v[l][r]++;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            v[i][j]+=v[i-1][j];
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            v[i][j]+=v[i][j-1];
        }
    }
    for(int i=0;i<q;i++){
        cin>>l>>r;
        cout << v[r][r]-v[l-1][r]-v[r][l-1]+v[l-1][l-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define VV(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a); i>n; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
int main() {
	int n; cin >> n;
	char m;
	int k;
	VV(int, v, 4, 14, 0);
	map<char, int> mc;
	mc['S'] = 0;
	mc['H'] = 1;
	mc['C'] = 2;
	mc['D'] = 3;
	map<int, char> mn;
	mn[0] = 'S';
	mn[1] = 'H';
	mn[2] = 'C';
	mn[3] = 'D';
	rep(i, 0, n) {
		cin >> m >> k;
		++v[mc[m]][k];
	}
	rep(i, 0, 4) {
		rep(j, 1, 14) {
			if (v[i][j] == 0) {
				cout << mn[i] << " " << j << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3168
#include<iostream>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
int main(){
  int N,M;
  long long ans=0,a,b;
  cin>>N>>M;
  vector <pair<long long, int>>pairs(N);
  for(int i=0;i<N;i++){
    scanf("%lld%d",&a,&b);
    pairs[i] = make_pair(a,b);
  }
  sort(pairs.begin(),pairs.end());
  for(int h=0;h<N;h++){
    if(M>pairs[h].second){
      ans+=pairs[h].second*pairs[h].first;
      M-=pairs[h].second;
    }
    else{
      ans+=pairs[h].first*M;
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
const int INF{int(1e9)};

int main()
{
  int n,k, d, a, ans=0;	cin >> n >> k;
  
  vector<int> ok(n,0);
  
  rep(i,k) {
    cin >> d;
    rep(j,d) {
      cin >> a;
      ok[a-1]=1;
      }
  }
    rep(i,n) {
      if(ok[i] == 0)
        ans++;
    }
  cout << ans << endl;
}

Measured memory_bytes: 3624
A,B,H,M=$<.read.split.map(&:to_i)

rad = 2*Math::PI

a = rad*(H/12.0 + M/60.0/12.0)
ax = A*Math.sin(a)
ay = A*Math.cos(a)

b = rad*M/60.0
bx = B*Math.sin(b)
by = B*Math.cos(b)

# p [ax,ay,bx,by]
# p [(ax-bx)**2, (ay-by)**2]
puts Math.sqrt((ax-bx)**2+(ay-by)**2)

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


int main(void) {
	int A, B, C;
	cin >> A >> B >> C;

	int ans = 0;
	for (; ans<1000; ans++) {
		if (((A|B|C)&1)==1) break;
		int a = A, b = B, c = C;
		A = (b>>1) + (c>>1);
		B = (a>>1) + (c>>1);
		C = (a>>1) + (b>>1);
	}
	
	if (ans>=1000) ans = -1;
	cout << ans << endl;
	return 0;
}


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

using namespace std;
bool custom_sort(tuple<string, int, int> t1, tuple<string, int, int> t2) {
  if(get<0>(t1) == get<0>(t2)) {
    return get<1>(t1) > get<1>(t2);
  } else {
    return get<0>(t1) < get<0>(t2);
  }
}

int main() {
  // N × (3 × 3)要素の配列を宣言
  /* vector<vector<vector<char>>> data(N, vector<vector<char>>(3, vector<char>(3))); */
  // int型の2次元配列(3×4要素の)の宣言
  /* vector<vector<int>> data(3, vector<int>(4)); */
  int N;
  cin >> N;
  string a;
  int b;
  vector<tuple<string, int, int>> vec;

  rep(i, N) {
    cin >> a >> b;
    vec.push_back(make_tuple(a, b, i+1));
  }

  sort(vec.begin(), vec.end(), custom_sort);

  for(tuple<string, int, int> t : vec) {
    cout << get<2>(t) << endl;
  }
}


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

int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c =='u')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}


Measured memory_bytes: 256
use std::cmp::{max,min};
use std::i32;

fn solve(a: i32, b: i32, c: i32, x: i32, y: i32) -> i32 {
    let mut ans = i32::MAX;
    for nc in 0..(max(2*x, 2*y)+1) {
        let rest_x = max(0, x - nc / 2);
        let rest_y = max(0, y - nc / 2);
        let price = a * rest_x + b * rest_y + c * nc;
        ans = min(ans, price);
    }
    ans
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let mut iter = s.split_whitespace().map(|w| w.trim().parse().ok().unwrap());
    let a = iter.next().unwrap();
    let b = iter.next().unwrap();
    let c = iter.next().unwrap();
    let x = iter.next().unwrap();
    let y = iter.next().unwrap();
    let r = solve(a, b, c, x, y);
    println!("{}", r);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//uniform_int_distribution<int>(1000,10000)(rng)

ll binpow(ll a, ll b)
{
    if (b == 0)
        return 1;
    ll res = binpow(a, b / 2);
    res*=res;
    if (b % 2)
        return res * a;
    return res;
}

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

string to_upper(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='a' && a[i]<='z') a[i]-='a'-'A';
    return a;
}
 
string to_lower(string a)
{
    for (int i=0;i<(int)a.size();++i) if (a[i]>='A' && a[i]<='Z') a[i]+='a'-'A';
    return a;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int d,t,s;
    cin>>d>>t>>s;
    if (t*s>=d)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

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

int main(){
  int n;
  while(cin>>n,n){
    pair<double,string> p[50];
    string s;
    for(int i=0;i<n;i++){
      double pr,a,b,c,d,e,f,sh,m;
      cin>>s>>pr>>a>>b>>c>>d>>e>>f>>sh>>m;
      p[i]=make_pair(-(sh*f*m-pr)/(m*(e+d)+a+b+c),s);
    }
      sort(p,p+n);
      for(int i=0;i<n;i++)cout<<p[i].second<<endl;
      cout<<'#'<<endl;
  }
  return 0;
}

Measured memory_bytes: 3260
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;
typedef pair<ll  ,ll > pll;

const ll maxn =2e6;
const ll mod = 1e9+7;
const ld PI = 4 * atan((ld) 1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define ms(x , y) memset(x , y , sizeof x);
ll pw(ll a, ll b) {
    return (!b ? 1 : (b & 1 ? a * pw(a * a % mod, b / 2) % mod : pw(a * a % mod, b / 2) % mod));
}

ll n , k;
ll a[maxn];
ll pos= 0 , neg = 0 , zer = 0;

bool chk(ll x){
    ll cnt = 0;
    for (int i = 0 ; i < n ; i ++){
        if(a[i] < 0){
            ll l = -1 , r = n;
            while(r - l > 1){
                ll mid = (l + r)/2;
                if(a[i]*a[mid] < x){
                    r = mid;
                }
                else{
                    l = mid;
                }
            }
            cnt+=n - r;
        }
        else{
            ll l = -1 , r = n;
            while(r - l > 1){
                ll mid = (l + r)/2;
                if(a[i]*a[mid] < x){
                    l = mid;
                }
                else{
                    r = mid;
                }
            }
            cnt+=r;
        }
        if(a[i]*a[i] < x){
            cnt--;
        }
    }
    cnt/=2;
    return(cnt < k);
}

int main(){
    migmig
    cin >> n >> k;
    for (int i = 0 ; i < n ; i ++){
        cin >> a[i];
        neg+=(int)(a[i] < 0);
        pos+=(int)(a[i] > 0);
        zer+=(int)(a[i] == 0);
    }
    sort(a , a + n);
    ll negt = neg * pos;
    ll zero = zer * neg + zer * pos;
    ll post = neg*(neg - 1) + pos*(pos - 1);
    if(k > negt and k <= negt + zero){
        dokme(0);
    }
    ll l = -1e18 , r = 1e18;
    while(r - l > 1){
        ll mid = ( l + r) / 2;
        if(chk(mid)){
            l = mid;
        }
        else{
            r = mid;
        }
    }
    cout << l;
    return(0);
}


//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.


Measured memory_bytes: 1792
A, B, K = (int(i) for i in input().split())


if B-A+1 > K*2:
    for i in range(K):
        print(A+i)
    for j in range(K-1, -1, -1):
        print(B-j)
else:
    for i in range(A, B+1):
        print(i)


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import sys

def main():
	N = int(input())
	
	btnList = []
	for _ in range(N):
		tmp = int(input())
		btnList.append(tmp)
	
	tugi = btnList[0]
	i = 1
	if tugi-1 == 1:
		print(i)
		sys.exit()
	while i < N+1:
		i += 1
		tugi = btnList[tugi-1]
		if tugi-1 == 1:
			print(i)
			sys.exit()
	print(-1)
	
if __name__ == "__main__":
	main()
	

Measured memory_bytes: 7084
// ========================================================================================================
// Library
// ========================================================================================================
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
using namespace std;

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long

void fastIOS()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}
// ========================================================================================================
// ========================================================================================================

int main()
{
	fastIOS();

    LL n , a, b;
    cin >> n >> a >> b;
    
    if(a>=n)
    {
        cout << n << endl;
    }
    else if(a+b>=n)
    {
        cout << a << endl;
    }
    else{
        LL cnt = a*(n/(a+b));
        n %= (a+b);
        if(a>=n)
        {
            cout << cnt+n << endl;
        }
        else{
            cout << cnt + a << endl;
        }
    }
    
    return 0;
}

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

int main(){
  char b;
  cin>>b;
  if(b=='A'){
    cout<<'T'<<endl;
    }
  else if(b=='T'){
    cout<<'A'<<endl;
  }  

  else if(b=='C'){
    cout<<'G'<<endl;
  }

  else if(b=='G'){
    cout<<'C'<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
    int N; cin >> N;
	FOR(i, 1, 10) FOR(j, 1, 10) {
        if (i * j == N) {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll mod=1e9+7;
#define endl '\n'
const ld PI=3.14159265358979;
#define w(x) int x;cin>>x;while(x--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vll vector<ll>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define F first
#define S second 
#define LB lower_bound
#define UB upper_bound
#define mset multiset
#define uset unordered_set
#define umap unordered_map
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll binpow(ll x, ll y, ll p){  ll res = 1;x = x % p;if (x == 0)return 0;while (y > 0)  { if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p;}return res;}  
ll gcd(ll a, ll b){ if (b == 0) return a; return gcd(b, a % b); } 
bool parity(ll x,ll y){ bool f = ((x ^ y) < 0);return !f;}

int main()
{
    IOS
    ll k;
    string s;
    cin>>k>>s;
    if(k>=s.size())
        cout<<s<<endl;
    else
    {
        cout<<s.substr(0,k)<<"..."<<endl;
    }
    
    return 0;  
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  int d, t, s;
  cin >> d >> t >> s;
  if(d <= t*s) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)


int main(){
ll A,V,B,W,T;
cin>>A>>V>>B>>W>>T;
if(W>=V){
    cout<<"NO"<<endl;
    return 0;
}
ll des =abs(A-B);
if(des<=T*(V-W)){
    cout<<"YES"<<endl;
    return 0;
}

cout<<"NO"<<endl;
    return 0;

}






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

int main() {
    char ch;
    while(1){
        scanf("%c",&ch);
        if(isalpha(ch)){
            if(islower(ch)) printf("%c",toupper(ch));
            else printf("%c",tolower(ch));
        }
        else printf("%c",ch);
        if(ch=='\n') break;
    }

}


Measured memory_bytes: 3148