akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef complex<ld> compd;
#define quickIO()	{cin.tie(0);	cout.sync_with_stdio(false);}
#define reach(i,a)	for(auto i:a)
#define rep(i,n)	for(int i=0;i<((int)n);i++)
#define REP(i,n)	for(int i=0;i<=((int)n);i++)
#define srep(i,a,n)	for(int i=a;i<((int)n);i++)
#define SREP(i,a,n)	for(int i=a;i<=((int)n);i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define RREP(i,n)	for(int i=n;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define mt	make_tuple
#define pb	push_back
template<typename T> istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec)	is >> x;
	return is;
}
template<typename T> ostream& operator << (ostream& os, vector<T>& vec) {
	os << "[";
	rep(i, vec.size())	os << (i ? ", " : "") << vec[i];
	os << "]";
	return os;
}
template<typename T> istream& operator >> (istream& is, pair<T, T>& p) {
	is >> p.first >> p.second;
	return is;
}
template<typename T> ostream& operator << (ostream& os, pair<T, T>& p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}
int bitcnt(ll x) {
	x = ((x & 0xAAAAAAAAAAAAAAAA) >> 1) + (x & 0x5555555555555555);
	x = ((x & 0xCCCCCCCCCCCCCCCC) >> 2) + (x & 0x3333333333333333);
	x = ((x & 0xF0F0F0F0F0F0F0F0) >> 4) + (x & 0x0F0F0F0F0F0F0F0F);
	x = ((x & 0xFF00FF00FF00FF00) >> 8) + (x & 0x00FF00FF00FF00FF);
	x = ((x & 0xFFFF0000FFFF0000) >> 16) + (x & 0x0000FFFF0000FFFF);
	x = ((x & 0xFFFFFFFF00000000) >> 32) + (x & 0x00000000FFFFFFFF);
	return x;
}
int bitcnt(int x) {
	x = ((x & 0xAAAAAAAA) >> 1) + (x & 0x55555555);
	x = ((x & 0xCCCCCCCC) >> 2) + (x & 0x33333333);
	x = ((x & 0xF0F0F0F0) >> 4) + (x & 0x0F0F0F0F);
	x = ((x & 0xFF00FF00) >> 8) + (x & 0x00FF00FF);
	x = ((x & 0xFFFF0000) >> 16) + (x & 0x0000FFFF);
	return x;
}
ll sqrtll(ll x) {
	ll left = 0, right = x;
	rep(i, 100) {
		ll mid = (left + right) >> 1;
		if (mid*mid <= x)	left = mid;
		else	right = mid;
	}
	return left;
}
ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a%b);
}
#define debug(x)	printf("Case #%d: ", x)
#define DEBUG 0
const int inf = 1e9;
const ld infl = 1e100;
const ll mod = 1e9+7;
const ld eps = 1e-9;
const int dx[] = { 1,0,-1,0,0 };
const int dy[] = { 0,1,0,-1,0 };

int main() {
	int n;	cin >> n;
	vint p(n);	cin >> p;
	// 一番左か一番右に動かす。ただ、これは「取り除く」と置き換えてもよい（取り除いた集合を右か左に任意の順番で割り当てられる）
	// そうすると必要なのは最長ストレート（ポーカー）
	vint l(n + 1);
	int ret = 0;
	rep(i, n) {
		l[p[i]] = l[p[i] - 1] + 1;
		ret = max(ret, l[p[i]]);
	}
	cout << n - ret << endl;
	return 0;
}

Measured memory_bytes: 1792
N = int(input())

def hoge(N):
    count = 0
    judge = False
    for i in range(1, N+1, 2):
        if N % i == 0:
            count += 1

    if count == 8:
        judge = True

    return judge

count = 0
for i in range(1, N+1, 2):
    if hoge(i):
        count += 1


print ("%d" % count)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
    char a,b,c,d;
    int s=0;
    cin>>a>>b>>c>>d;
    if(a=='2')s++;
    if(b=='2')s++;
    if(c=='2')s++;
    if(d=='2')s++;
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0585

"""
import sys
from sys import stdin
from collections import namedtuple
input = stdin.readline


def closest_part(points, n):
    # ?????¬???p324???
    if n <= 1:
        return float('inf')
    m = n // 2
    x = points[m][0]
    d = min(closest_part(points[:m], m), closest_part(points[m:], n-m))

    points.sort(key=lambda p:p[1])
    b = []
    for p in points:
        if (p[0] - x)**2 >= d:
            continue
        for q in b[::-1]:
            # dx = p[0] - b[-j-1][0]
            # dy = p[1] - b[-j-1][1]
            dx = p[0] - q[0]
            dy = p[1] - q[1]
            if dy**2 >= d:
                break
            d = min(d, (dx**2 + dy**2))
        b.append(p)
    return d

def main(args):
    n = int(input())
    points = [tuple(map(int, input().split())) for _ in range(n)]
    points.sort()               #  x????????§??????????????????

    result = closest_part(points, n)
    print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 84488
n = int(input())
arr = [int(x) for x in input().split()]

count = {}
for x in arr:
    if x in count:
        count[x] += 1
    else:
        count[x] = 1

s = sum(arr)

q = int(input())
for i in range(q):
    b, c = [int(x) for x in input().split()]

    if b in count and count[b] > 0:
        s -= b*count[b]
        s += c*count[b]

        if c in count:
            count[c] += count[b]
        else:
            count[c] = count[b]

        count[b] = 0

    print(s)


Measured memory_bytes: 20424
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

ll divceil(ll a, ll b){
	return (a+b-1)/b;
}
#define N 112345
typedef pair<ll, int> pli;
ll b[N], l[N], u[N], f[N];
vector<pli> v;
ll w[N]={};

int main(){
	int n; ll x; scanf("%d%lld", &n, &x);
	REP(i, n){
		scanf("%lld%lld%lld", b+i, l+i, u+i);
		f[i] = max(l[i]*x, u[i]*x-(u[i]-l[i])*b[i]);
	 	v.EB(f[i], i);
	}
	sort(v.begin(), v.end(), greater<pli>());
	REP(i, n) w[i+1]=w[i]+v[i].first;
	ll s = 0, ans = LLONG_MAX;
	REP(i, n) s += b[i]*l[i];
	DEBUG("s=%lld\n", s);
	REP(i, n) {
		ll a = v[i].first; int j = v[i].second;
		ll t = s - a;
		DEBUG("%d: %lld (%d) t=%lld\n", i, a, j, t);
		int mi = -1, mx = n+1; // mi->ng, mx->ok
		while(mx-mi>1){
			int md = (mi+mx)/2;
			ll sm = w[md];
			if(i < md) sm -= a;
			// DEBUG("  [%d, %d) => %lld\n", 0, md, sm);
			if(sm >= t){
				mx = md;
			} else {
				mi = md;
			}
		}
		if(mx==n+1) continue;
		ll r = w[mx];
		if(i < mx) r -= a;
		DEBUG("  [%d, %d) => %lld\n", 0, mx, r);
		r = s - r;
		DEBUG("  nokori %lld\n", r);
		ll tmp = mx * x;
		if(i < mx) tmp -= x;
		if(r < 0) {
		}else if(r < l[j] * b[j]){
			tmp += divceil(r, l[j]);
		} else {
			tmp += b[j] + divceil(r - l[j]*b[j], u[j]);
		}
		SML(ans, tmp);
	}
	printf("%lld\n", ans);
}




Measured memory_bytes: 6000
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def LCS(S, T, f=False):

    L1 = len(S)
    L2 = len(T)
    dp = [[0] * (L2 + 1) for i in range(L1 + 1)]

    for i in range(L1 - 1, -1, -1):
        for j in range(L2 - 1, -1, -1):
            r = max(dp[i + 1][j], dp[i][j + 1])
            if S[i] == T[j]:
                r = max(r, dp[i + 1][j + 1] + 1)
            dp[i][j] = r

    if not f:
        return dp[0][0]

    res = []
    i = 0
    j = 0
    while i < L1 and j < L2:
        if S[i] == T[j]:
            res.append(S[i])
            i += 1
            j += 1
        elif dp[i][j] == dp[i + 1][j]:
            i += 1
        elif dp[i][j] == dp[i][j + 1]:
            j += 1

    return (dp[0][0], ''.join(res))


def main():

    s = in_s()
    t = in_s()

    _, ans = LCS(s, t, True)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 138760
a, b = map(int, input().split())
a_line = (a-1) // 50 + 1
b_line = (b-1) // 50 +1
print(a_line*2 + b_line*2, 99)
for i in range(a_line):
    if i == a_line-1:
        print(('.#'*((a-1)%50) + '#'*(99-2*((a-1)%50))))
    else:
        print(('.#'*49+'.'))
    print('#'*99)
for i in range(b_line):
    print('.'*99)
    if i == b_line-1:
        print(('#.'*((b-1)%50) + '.'*(99-2*((b-1)%50))))
    else:
        print(('#.'*49+'#'))

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
long long int p,q,count,ans,k;
int prime[100000];
char a[1000005];

int gcd(int b,int a){
	int c=1;
	while(1){
		c=a%b;
		a=b;
		b=c;
		if(c==0)break;
	}
	return a;
}

void check(){
	 count=0;
	for(int i=2;i<1000005;i++){
		if(a[i]=='1')continue;
		prime[count]=i;
		count++;
		for(int j=i;j<1000005;j+=i){
			a[j]='1';
		}
	}
}

int main(){
	for(int i=2;i<1000005;i++){
		a[i]='0';	
	}
	check();
	cin>> p>>q;
	q=q/gcd(p,q);
	ans=1;
	k=0;
	
	while(q>1&&count>k){
		if(q%prime[k]==0)ans*=prime[k];
		while(q%prime[k]==0)q/=prime[k];
		k++;
	}
	cout<< ans*q<<endl;
}

Measured memory_bytes: 4380
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s[10000];
  int aa=0;
  int bb=0;
  int ab=0;
  int ba=0;
  for(int i=0;i<n;i++){
    cin >> s[i];
    int ss = s[i].size();
    if(s[i][0]=='B'){
      bb++;
    }
    if (s[i][ss-1]=='A'){
      aa++;
    }
    if(s[i][0]=='B'&&s[i][ss-1]=='A'){
      ba++;
    }
    for(int j=0;j<ss;j++){
      if(s[i][j]=='A'&&s[i][j+1]=='B'){
        ab++;
      }
    }
  }
  if(n==1){
    cout << ab << endl;
  } else if (ba==aa&&aa==bb&&bb==0){
    cout << ab << endl;
  }
  else if(ba==aa&&aa==bb){
    cout << ab+aa-1 << endl;
  } else {
  cout << ab+min(aa,bb) << endl;
}
}


Measured memory_bytes: 768
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

const double PI = 3.14159;

int main()
{
	int n;
	while (true) {
		cin >> n;
		if (n==-1) break;
		
		double deg = 0.0;
		for (int i=2; i<=n; i++) deg += atan2(1.0, sqrt(static_cast<double>(i-1)));
		
		double x = sqrt(static_cast<double>(n)) * cos(deg);
		double y = sqrt(static_cast<double>(n)) * sin(deg);
		
		cout << fixed << setprecision(3) << x << endl << y << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3620
import sys
for s in sys.stdin:
  n,m=map(int,s.split())
  if n==0&m==0:break
  G=range(1,n+1)
  while n>1:
    if m%n==0:G=G[:n-1]
    else:G=G[m%n:]+G[:(m-1)%n]
    n-=1
  print G[0]

Measured memory_bytes: 4236
N, W = map(int, input().split())
weight = []
value = []
for i in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    value.append(v)
dp = [[0 for _ in range(100005)] for _ in range(105)]
for i in range(N):
    for j in range(W+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if j - weight[i] >= 0:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-weight[i]]+value[i])
print(dp[N][W])


Measured memory_bytes: 171656
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,n,j) for(int i=(j);i<(n);++i)
#define ssort(n) sort((n).begin(),(n).end())
#define rsort(n) sort((n).begin(),(n).end(),greater<int>())
#define mp make_pair
using ll=long long;
using ld=long double;
typedef pair<int,int> P;
typedef pair<P,int> COST;
#define repl(i,n) for(ll i=0;i<(n);++i)
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
using Graf=vector<vector<int>>;
#define MAX 1000000007
#include<atcoder/all>
using namespace atcoder;

int main()
{
    int n,q;
    cin >> n >> q;
    vector<int> t(q),u(q),v(q);
    rep(i,q)cin >> t[i] >> u[i] >> v[i];

    dsu d(n);
    rep(i,q){
        if(t[i]==1){
            if(d.same(u[i],v[i])){
                cout << 1 << endl;
            }else{
                cout << 0 << endl;
            }
        }else{
            d.merge(u[i],v[i]);
        }
    }

}

Measured memory_bytes: 5816
def solve():
    n=int(input())
    ev=[[] for _ in range(n)]
    for i in range(n):
        a=int(input())
        l=[]
        for j in range(a):#証言
        
            x,y=map(int,input().split())
            l.append([x-1,y])
        ev[i]=l
    
    ans=0
    
    for i in range(2**n):
        result=0
        honest=[]
        for j in range(n):
            
            if ((i>>j)&1): #jは正直者
                honest+=ev[j]
                #正直者と仮定した人の証言を集める    
                
        for j in range(n):
            
            if ((i>>j)&1): #jは正直者
                result+=1
                if [j,0] in honest:
                    result=0
                    break
            else:
                if [j,1] in honest:
                    result=0
                    break
                    
        ans=max(ans,result)
        
    print(ans)
    
solve()

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

int main() {
  string S;
  cin >> S;
  int N = S.size();
  bitset<100000> bit(S);
  int count1 = bit.count();
  int min01 = min(N - count1, count1);
  
  cout << 2 * min01 << endl;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    string s;
    cin>>s;
    string ans="";
    for(char c:s){
        if(c!='B')ans+=c;
        else if(ans.size())ans.erase(prev(ans.end()));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static ADJ[] edge;
	public static boolean visited[];
	public static int go_time[];
	public static int back_time[];
	public static int current_time;

	public static void main(String[] args) {

		Scanner sc = new  Scanner(System.in);

		int V = sc.nextInt();
		edge = new ADJ[V];

		for(int i = 0; i < V; i++){
			edge[i] = new ADJ();
		}

		visited = new boolean[V];
		for(int i = 0; i < V; i++){
			visited[i] = false;
		}

		go_time = new int[V];
		back_time = new int[V];

		int node_id,num,tmp_to;

		for(int loop = 0; loop < V; loop++){
			node_id = sc.nextInt();
			node_id--;

			num = sc.nextInt();

			for(int i = 0; i < num; i++){
				tmp_to = sc.nextInt();
				tmp_to--;
				edge[node_id].to.add(tmp_to);
			}
		}

		current_time = 1;

		for(int i = 0; i < V; i++){
			if(visited[i])continue;
			visited[i] = true;
			dfs(i);
		}

		StringBuilder ans = new StringBuilder();

		for(int i = 0; i < V; i++){
			ans.append(Integer.toString(i+1)).append(" ").append(Integer.toString(go_time[i])).
				append(" ").append(Integer.toString(back_time[i])).append("\n");
		}

		System.out.print(ans.toString());
	}

	public static void dfs(int node_id){

		go_time[node_id] = current_time++;
		int next_node;

		for(int i = 0; i < edge[node_id].to.size(); i++){

			next_node = edge[node_id].to.get(i);
			if(visited[next_node])continue;

			visited[next_node] = true;
			dfs(next_node);
		}
		back_time[node_id] = current_time++;
	}

}

class ADJ{
	ArrayList<Integer> to;

	ADJ(){
		to = new ArrayList<Integer>();
	}
}


Measured memory_bytes: 27828
<?php
$base=1;
    fscanf(STDIN,"%d %d",$N,$P);
    if($N==1){
	echo $P;
    return 0;
    }
    if($N>50){
	echo '1';
    return 0;
    }
    while(pow($base,$N)<=$P){
        if($P%(pow($base,$N))==0){
            $ans=$base;
        }
        $base++;
    }
    
    echo $ans;


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

using namespace std;

typedef pair<double,int> pdi;

class Node
{
public:
    int w;
    char ch;
    int l,r;
    Node(int _w,int _l,int _r)
    {
        w=_w;l=_l;r=_r;
    }
    Node()
    {

    }
};

class Tree
{
public:
    int num;
    vector<Node> data;
    priority_queue<pdi,vector<pdi>,greater<pdi> > s;
    vector<pdi> origin;
    int root;
    map<char,string> HC;
    map<char,int> CL;

    Tree(map<char,double> f)
    {
        num=0;
        data.resize(f.size()*4);
        init(f);
    }

    void init(map<char,double> f)
    {
        origin.clear();
        for(auto it=f.begin();it!=f.end();it++)
        {
            int idx=createNode(it->second,it->first,-1,-1);
            origin.push_back(make_pair(it->second,idx));
        }
        if(f.size()==1)
        {
            int idx=createNode(0,0,-1,-1);
            origin.push_back(make_pair(0,idx));
        }
        for(int i=0;i<origin.size();i++)
        {
            s.push(origin[i]);
        }
        build();
    }

    void build()
    {
        while(s.size()>1)
        {
            pdi p1=s.top();s.pop();
            pdi p2=s.top();s.pop();
            int w=p1.first+p2.first;
            int idx=merge(p1.second,p2.second);
            s.push(make_pair(p1.first+p2.first,idx));
        }
        root=s.top().second;
    }
    int createNode(int w,char ch,int l,int r)
    {
        Node node(w,l,r);
        node.ch=ch;
        data[num++]=node;
        return num-1;
    }

    int merge(int l,int r)
    {
        return createNode(data[l].w+data[r].w,'$',l,r);
    }

    void go()
    {
        getHC(root,"");

    }

    void getHC(int p,string s)
    {
        if(data[p].l==-1&&data[p].r==-1)
        {
            HC[data[p].ch]=s;
            CL[data[p].ch]=s.length();
            return;
        }

        getHC(data[p].l,s+"0");
        getHC(data[p].r,s+"1");
    }
};

int main()
{
    string s;

    while(cin>>s)
    {
        map<char,int> mp;
        for(int i=0;i<s.length();i++)
        {
            mp[s[i]]++;
        }
        map<char,double> f;
        for(auto it=mp.begin();it!=mp.end();it++)
        {
            f[it->first]=it->second*1.0/s.length();
        }


        Tree tree(f);
        tree.go();
        map<char,int> CL=tree.CL;

        int len=0;
        for(auto it=mp.begin();it!=mp.end();it++)
        {
            len+=it->second*CL[it->first];
        }
        cout<<len<<endl;
    }

    return 0;
}



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

bool valid(int y, int x, int oy, int ox){
    if (y >= oy || y < 0){
      return false;
    }
    if (x >= ox || x < 0){
      return false;
    }
    return true;
}
int main(){
  int y, x;
  cin >> y >> x;
  int new_grid[y][x] = {{0}};
  int bomb_grid[y][x] = {{0}};
  for (int i=0; i<x; i++){
    new_grid[0][i] = 0;
  }
  for (int i=0; i<x; i++){
    bomb_grid[0][i] = 0;
  }
  for (int i=0; i<y; i++){
    string spot;
    cin >> spot;
    for (int j=0; j<x; j++){
      if (spot[j] == '#'){
        bomb_grid[i][j] = 1;
        for (int k = -1; k<=1; k++){
          for (int l=-1; l<=1; l++){
            if (valid(i+k, j+l, y, x)){
              new_grid[i+k][j+l]++;
                
            }
          }
        }
      }
    }
  }
  for (int i=0; i<y; i++){
    for (int j=0; j<x; j++){
      if (bomb_grid[i][j] == 1){
        cout << "#";
      }else{
        cout << new_grid[i][j];
      }
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N, K = [int(_) for _ in input().split()]
S = str(input())

Nums = []
now, cnt = 1, 0
for i in range(N):
    if S[i] == str(now): cnt += 1
    else:
        Nums.append(cnt)
        now = 1 - now
        cnt = 1
if cnt != 0: Nums.append(cnt)
if len(Nums) % 2 == 0: Nums.append(0)


# add = 2 * K + 1
# ans = 0
# for i in range(0, len(Nums), 2):
#     tmp = 0
#     left = i
#     right = min(i+add, len(Nums))
#     j = left
#     while j < right:
#         tmp += Nums[j]
#         j += 1
#     ans = max(tmp, ans)
# print(ans)

#------------------------
add = 2 * K + 1
ans = 0
left = 0
right = 0
tmp = 0
for i in range(0, len(Nums), 2):
    nextLeft = i 
    nextRight = min(i + add, len(Nums))
    while nextLeft > left:
        tmp -= Nums[left]
        left += 1
    while nextRight > right:
        tmp += Nums[right]
        right += 1
    #print('left, right:   ', left, right)
    ans = max(tmp, ans)
        
print(ans)


Measured memory_bytes: 4212
//
//  main.cpp
//  Source
//
//  Created by Taguwa on 2020/01/23.
//  Copyright © 2020 Taguwa. All rights reserved.
//

#include <iostream>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c <= 21) cout << "win";
    else cout <<"bust";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

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

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

int main() {
	int N, M;
	cin >> N >> M;
	vector<string> A(N), B(M);
	rep(i,N) cin >> A[i];
	rep(i,M) cin >> B[i];
	bool res = false;
	rep(i,N) {
		rep(j,N) {
			if(i+M-1 >= N || j+M-1 >= N) continue;
			bool f = true;
			rep(k,M) {
				rep(l,M) {
					if(A[i+k][j+l] != B[k][l])
						f = false;
				}
			}
			if(f) res = true;
		}
	}
	cout << (res ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
void main() {
  problem();
}

void problem() {
  auto X = scan!long;

  long solve() {
    return 8 - (X - 400) / 200;
  }

  solve().writeln;
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

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


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

typedef long long ll;

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

int main() {
    int n,m; cin >> n >> m;
    string s,t; cin >> s >> t;
    auto L = lcm(n,m);
    map<ll,char> word;
    for (int i = 0; i < n; i++) word[L/n*i] = s[i];
    bool ok = 1;
    for (int i = 0; i < m; i++) {
        if (word.count(L/m*i) && word[L/m*i] != t[i])
            ok = 0;
    }
    if (ok) cout << L; else cout << -1;
    return 0;
}


Measured memory_bytes: 6144
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[110];
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	int c=0;
	for(int i=0;i<a;i++){
		scanf("%d",p+i);
		c+=p[i];
	}
	int cnt=0;
	for(int i=0;i<a;i++){
		if(p[i]*4*b>=c)cnt++;
	}
	if(cnt>=b)printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
using namespace std;
#define INF 0x3f3f3f3f
//#define INF 1100000000000000000LL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main() {
	string S,T;
	cin>>S>>T;
	int aS[26]={},aT[26]={};
	for(int i=0;i<S.length();i++){
		aS[S[i]-'a']++;
	}
	for(int i=0;i<T.length();i++){
		aT[T[i]-'a']++;
	}
	string A,B;
	for(int i=0;i<26;i++){
		for(int j=0;j<aS[i];j++){
			A+=(char)('a'+i);
		}
		for(int j=0;j<aT[i];j++){
			B+=(char)('a'+i);
		}
	}
	reverse(B.begin(),B.end());
	//cout<<A<<" "<<B<<endl;
	if(A<B)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

long long GCD(long long a, long long b){
  if (b == 0) return a;
  return GCD(b, a % b);
}

long long lcm(long long a, long long b){
  return a * b / GCD(a, b);
}

int main(){
  ll a, b, c, d; cin >> a >> b >> c >> d;
  ll l = lcm(c, d);

  ll under_b = b - b / c - b / d + b / l;
  ll under_a = (a - 1) - (a - 1) / c - (a - 1) / d + (a - 1) / l;
  cout << under_b - under_a << endl;
}


Measured memory_bytes: 256
use proconio::input;
use std::cmp;

fn main() {
    input! {
        n: usize,
        m: usize,
        mut k: usize,
        la: [usize; n],
        lb: [usize; m],
    }

    let mut a = vec![0];
    let mut b = vec![0];

    for i in 0..n {
        a.push(a[i] + la[i])
    }

    for i in 0..m {
        b.push(b[i] + lb[i])
    }

    let mut ans = 0;
    let mut j = m;

    for i in 0..=n {
        if a[i] > k {
            break
        }

        while b[j] > k - a[i] {
            j -= 1
        }

        ans = cmp::max(ans, i + j)
    }

    println!("{}", ans)
}


Measured memory_bytes: 12696
a=int(input())
b=int(input())
if (a==1 or a==2) and (b==2 or b==1):
  print(3)
elif (a==2 or a==3) and (b==3 or b==2):
  print(1)
elif (a==1 or a==3) and (b==3 or b==1):
  print(2)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int  main()
{ string s;
 cin>>s;
 int c1=0;
 for(int i=0;i<4;i++)
 {  if(s[i]=='+')
         c1++;
     else
         c1--;
 }
       cout<<c1;
     
}

Measured memory_bytes: 3564
import java.util.*;
import java.io.*;

//yukicoderの５円玉が使われる問題でも解きやすかったた考え方
//繰り下がりが発生した場合は、今の桁の数nowを10-nowとみる
public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		String s = fs.next();
		StringBuffer sb = new StringBuffer(s);
		s = sb.reverse().toString();

		s = s+"0";
		char c[] = s.toCharArray();
		int n = s.length();
		int dp[][] = new int[n+1][2];
		int INF = Integer.MAX_VALUE/2;
		for(int i=0;i<n+1;i++) {
			for(int j=0;j<2;j++)dp[i][j] = INF;
		}
		dp[0][0]=0;
		for(int i=0;i<n;i++) {
			int now = c[i] - '0';
			for(int j=0;j<2;j++) {
				int ni = i+1, nj = 0;
				now += j; 
				//ぴったり払う場合
				dp[ni][nj] = Math.min(dp[ni][nj], dp[i][j]+now);
				
				//繰り下がりで払う場合
				nj ++;
				int rnow = 10 - now;
				dp[ni][nj] = Math.min(dp[ni][nj], dp[i][j]+rnow);
				
			}
		}
		int ans = dp[n][0];
		System.out.println(ans);
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 68552
import java.util.NoSuchElementException

fun main(args: Array<String>) = FastScanner().run {
    val n = nextInt()
    val s = next()
    val t = next()
    var ret = n * 2
    for (i in s.indices) {
        var isSame = true
        for (j in 0 until s.length - i) {
            if (s[j + i] != t[j]) isSame = false
        }
        if (isSame) {
            ret = n + i
            break
        }
    }
    println(ret)
}

class FastScanner {
    private val printable = 33..126
    val `in` = System.`in`
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = `in`.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }
    fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else return -1
    }
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }
    fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }
    fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }
    fun nextInt(): Int {
        val nl = nextLong()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }
    fun nextDouble(): Double {
        return next().toDouble()
    }
}

Measured memory_bytes: 31140
#!/usr/bin/env python3
import math

def main():
    X = int(input())
    max_num = 1
    for b in range(1,X+1):
        for p in range(2,X+1):
            current = b ** p
            if current <= X:
                max_num = max(max_num,current)
            else:
                break
    print(max_num)        
            
            

if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	string s;
	cin >> s;
	s.pop_back();
	while (s.size() % 2) s.pop_back();
	while (1) {
		if (s.substr(0, s.size() / 2) == s.substr(s.size() / 2)) {
			cout << s.size() << endl;
			return 0;
		}
		s.pop_back();
		s.pop_back();
	}
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long  dp[11][1001];

void compute(void){

  dp[0][0] = 1;

  for( int i = 0 ; i <= 100 ; i++ ){  // 同じ数は１度しか使えないので、for３つ目でi+kををやる必要がある。
      for( int j = 9 ; j >= 0 ; j-- ){// 入力される n は１~9だから最高で９回ループを行う
	for( int k = 0 ; i+k <= 1000 ; k++ ){  //入力される s は最高1000だから
	dp[j+1][k+i] += dp[j][k];
      }
    }
  }
}

int main(void){

  compute();

  int n,s;
  while( cin >> n >> s, n || s ){
  cout << dp[n][s] << endl;
  }
  return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	LL N, n, h, w, x, y;
	cin >> N;
	for (h = 1; h <= 3500; h ++)
		for (n = 1; n <= 3500; n ++)
		{
			x = 4 * h * n - (h + n) * N, y = N * h * n;
			if (x > 0 && !(y % x))
				return printf("%lld %lld %lld\n", h, n, w = y / x), 0;
		}
}


Measured memory_bytes: 256
N,Y = map(int,input().split())
res = 0
for i in range(N+1):
	if res == 1:
		break
	for j in range(N+1-i):
		if 10000*i+5000*j+1000*(N-i-j) == Y:
			print(i,j,N-i-j)
			res = 1
if res == 0:
	print(-1,-1,-1)

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

#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                                                       \
    for(long long hoge = 0; (hoge) < (n); ++(hoge))                            \
    cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
const ll INF = LLONG_MAX / 2;
const ll MOD = 1e9 + 7;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    ll N;
    cin >> N;
    if(N & 1) {
        cout << 0 << endl;
    } else {
        ll ans = 0;
        N >>= 1;
        ll p5 = 5;
        while(N / p5) {
            ans += N / p5;
            p5 *= 5;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    private static final long MOD = 1000000007;

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

        final int n = sc.nextInt();

        final int[] ex = new int[1001];
        for (int i = 2; i <= n; i++) {
            final List<Map<Integer, Integer>> pfs = primeFactorize(i);
            for (Map<Integer, Integer> pf : pfs) {
                for (Map.Entry<Integer, Integer> e : pf.entrySet()) {
                    ex[e.getKey()] += e.getValue();
                }
            }
        }

        long ans = 1;
        for (int i = 2; i <= n; i++) {
            ans *= ex[i] + 1;
            ans %= MOD;
        }

        System.out.println(ans);
    }

    private static List<Map<Integer, Integer>> primeFactorize(int n) {
        final List<Map<Integer, Integer>> res = new ArrayList<>();
        for (int a = 2; a*a <= n; a++) {
            if (n % a != 0) {
                continue;
            }
            int ex = 0;
            while (n % a == 0) {
                ex++;
                n /= a;
            }
            res.add(Collections.singletonMap(a, ex));
        }
        if (n != 1) {
            res.add(Collections.singletonMap(n, 1));
        }
        return res;
    }
}


Measured memory_bytes: 21972
#include <stdio.h>

int nagasa(const char* asumikana) {
	int mizuhasu = 0;
	while (*asumikana) mizuhasu++, asumikana++;
	return mizuhasu;
}

int main(void) {
	char S[64], T[64];
	int i;
	if (scanf("%63s", S) != 1) return 1;
	if (scanf("%63s", T) != 1) return 1;
	for (i = nagasa(S) - nagasa(T); i >= 0; i--) {
		int ok = 1, j;
		for (j = 0; T[j] != '\0'; j++) {
			if (S[i + j] != '?' && S[i + j] != T[j]) {
				ok = 0;
				break;
			}
		}
		if (ok) {
			for (j = 0; j < i; j++) {
				putchar(S[j] == '?' ? 'a' : S[j]);
			}
			fputs(T, stdout);
			for (j = i + nagasa(T); S[j] != '\0'; j++) {
				putchar(S[j] == '?' ? 'a' : S[j]);
			}
			putchar('\n');
			return 0;
		}
	}
	puts("UNRESTORABLE");
	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<iostream>

using namespace std;

int main(void) {

	int n, d, x, a[100], num;

	cin >> n >> d >> x;

	num = x;

	for (int i = 0; i < n; i++)
	{
		cin >> a[i];

		num += ((d - 1) / a[i]) + 1;
	}

	cout << num << "\n";

	return 0;
}

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

long long int f(long long int n){
  if(n==-1){
    return 0;
  }else{
    long long int output=0;
    double d=2;
    output+=static_cast<long long int>(floor((n+1)/d))%2;
    for(long long int i=1;i<40;i++){
      long long int digit=pow(2,i);
      long long int mod=(n+1)%(2*digit);
      long long int k;
      if(mod<=digit){
        k=0;
      }else{
        k=mod%2;
      }
      output+=digit*k;
    }
    return output;
  }
}
    
int main(){
  long long int a,b;
  cin>>a>>b;
  cout<< (f(a-1) ^ f(b)) << endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, K: int):
    if A + K > B - K:
        for i in range(A, B+1):
            print(i)
        return

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


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(A, B, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 200005
#define MOD 1000000007

typedef long long int lli;

// ab[i][0]: 刀iが与えるダメージのポイント
// ab[i][1]: 刀iが1回きりの場合1, そうでない場合0
int ab[MAX][2];

int des(const void *a, const void *b) {
  return ab[*(int*)b][0] - ab[*(int*)a][0];
} /* 8,7,6,5.. */

int main(void) {
  int N, H;
  scanf("%d %d", &N ,&H);

  rep(i, 0, N) {
    scanf("%d %d", &ab[i][0], &ab[i+N][0]);
    ab[i][1] = 0; ab[i+N][1] = 1; 
  }

  int idx[MAX];
  rep(i, 0, 2 * N) idx[i] = i;
  qsort(idx, 2 * N, sizeof(int), des);

  int sum = 0;
  int h = H;
  int ans = 0;
  for ( int m = 0; m < 2 * N; m++ ) {
    int i = idx[m];
    if ( ab[i][1] == 0 ) {
      ans += (h - 1) / ab[i][0] + 1;
      break;
    }
    h -= ab[i][0];
    ans++;
    if ( h <= 0 ) break;
  }
  printf("%d\n", ans);
  return 0;
}


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

using namespace std;

int main(){
    string day[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string s;
    cin >> s;
    int diff = 0;
    for(int i = 0; i < 7; i++){
        if(day[i] == s){
            diff = 7-i;
        }
    }
    cout << diff << endl;
}


Measured memory_bytes: 256
// AtCoder Grand Contest 013
// C - Ants on a Circle

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;


const int MAX_N = 100000;

int N;
ll L, T;
ll x[MAX_N], xa[MAX_N];
int w[MAX_N];

int main() {

    ll d, k;
    int slide;

    cin >> N >> L >> T;
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> w[i];
        w[i] = (w[i] == 1 ? 1 : -1);
        xa[i] = ((x[i] + w[i] * T) % L + L) % L;
    }
    sort(xa, xa + N);

    k = 0;
    for (int i = 1; i < N; i++) {
        d = (x[i] + w[i] * T) - (x[0] + w[0] * T);
        k += (d > 0) ? (d / L) : (-d / L + 1);
    }
    k = (k * w[0] + N) % N;
    slide = lower_bound(xa, xa + N, ((x[0] + w[0] * T) % L + L) % L) - xa;
    if (xa[slide] == xa[(slide + 1) % N] && w[0] > 0) {
        slide++;
    }

    for (int i = 0; i < N; i++) {
        cout << xa[(N + slide - k + i) % N] << endl;
    }

    return 0;

}



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc154() {
	ll n, k;
	double ans;

	cin >> n >> k;

	vector<ll> p(n);
	vector<ll> s(n + 1);
	s[0] = 0;
	rep(i, n) {
		cin >> p[i];
		s[i + 1] = s[i] + p[i];
	}

	ll pos = 0;
	ll num = -1;
	rep(i, n - k + 1) {
		if ((s[i + k] - s[i]) >= num) {
			num = s[i + k] - s[i];
			pos = i;
		}
	}

	ans = 0;
	rep(i, k) {
		ans += (p[pos + i] + 1) / 2.0f;
	}

	cout << fixed;
    cout << setprecision(12) << ans;
}

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

	solve_abc154();

	return 0;
}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		int a = Integer.parseInt(s,16);
		s = scan.next();
		int b = Integer.parseInt(s,16);
		if(a < b){
			System.out.println("<");
		}else if(a == b){
			System.out.println("=");
		}else{
			System.out.println(">");
		}
		scan.close();

	}

}

Measured memory_bytes: 22996
import java.util.ArrayList;
import java.util.Scanner;
public class Main {

	public static final int MAX = 999999;

	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		ArrayList<Integer> primeNumbers = new ArrayList<Integer>();
		boolean[] notPrime = new boolean[Main.MAX];
		primeNumbers.add(2);
		for(int i = 3; i < Main.MAX; i += 2) {
			if(!notPrime[i]) {
				primeNumbers.add(i);
				for(int j = i + i; j < Main.MAX; j += i) {
					notPrime[j] = true;
				}
			}
		}
		while(scan.hasNext()){
			long n = scan.nextLong();
			int i = 0;
			for(i = 0; i < primeNumbers.size(); i++) {
				if(primeNumbers.get(i) > n) break;
			}
			System.out.println(i);
		}
	}
}

Measured memory_bytes: 25280
/*input
*/
#define debug 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; typedef double db;
const int N = 1e6 + 5, M = 1e9 + 7; const db eps = 1e-8;
typedef vector<ll> vi; typedef vector<vi> vii;
void solve();
void print(){cout<<'\n';}template<class T,class ...U>void print(T x, U ...y){cout<<x<<' ';print(y...);}
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  cout << setprecision(2) << fixed;
  if(debug){freopen("main.cpp","r",stdin);string x;cin>>x;}
  solve();
}
//
ll a[N];
ll qpow(ll x, ll n) {
  ll res = 1;
  for (; n; n >>= 1, x = x * x % M) if (n & 1) res = res * x % M;
  return res;
}
int p[N], pcnt, pre[N], cnt[N];
bool vis[N];
void add(int x) {
  int t;
  while (x > 1) {
    int k = 0;
    t = pre[x];
    while (x % t == 0) x /= t, k++;
    cnt[t] = max(cnt[t], k);
  }
}
void solve() {
  for (int i = 2; i < N; i++) {
    if (!vis[i]) p[pcnt++] = i, pre[i] = i;
    for (int j = 0; j < pcnt && (ll)i * p[j] < N; j++) {
      vis[i * p[j]] = 1, pre[i * p[j]] = p[j];
      if (i % p[j] == 0) break;
    }
  }
  int n; cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    add(a[i]);
  }
  ll prod = 1;
  for (int i = 2; i < N; i++) {
    if (cnt[i]) {
      prod = prod * qpow(i, cnt[i]) % M;
      // cout << i << ' ' << cnt[i] << endl;
    }
  }
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans = (ans + prod * qpow(a[i], M - 2)) % M;
  }
  cout << ans << endl;
}


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

int main()
{
    int n,i,j;
    cin >> n;
    vector<vector<int>> f(n,vector<int>(10));
    vector<vector<long long>> p(n,vector<long long>(11));
    for(i = 0;i < n;++i){
        for(j = 0;j < 10;++j){
            cin >> f.at(i).at(j);
        }
    }
    for(i = 0;i < n;++i){
        for(j = 0;j < 11;++j){
            cin >> p.at(i).at(j);
        }
    }
    int bit;
    vector<int> ans(1023);
    for(bit = 1;bit < 1024;++bit){
        vector<int> eigyo(10,0);
        for(i = 0;i < 10;++i){
            if(bit & (1 << i)){
                eigyo.at(i) = 1;
            }
        }
        vector<int> kaburi(n,0);
        for(i = 0;i < n;++i){
            for(j = 0;j < 10;++j){
                kaburi.at(i) += f.at(i).at(j)*eigyo.at(j);
            }
        }
        for(i = 0;i < n;++i){
            ans.at(bit-1) += p.at(i).at(kaburi.at(i));
        }
    }
    int max = ans.at(0);
    for(i = 1;i < 1023;++i){
        if(max < ans.at(i)){
            max = ans.at(i);
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256