akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

void func(long long n, std::vector<long long> a, std::vector<long long> b) {
    // check
    // cout << N << endl;
    // rep(i, N + 1) {
    //     if (i > 0) cout << " ";
    //     cout << A[i];
    // }
    // cout << endl;
    // rep(i, N) {
    //     if (i > 0) cout << " ";
    //     cout << B[i];
    // }

    ll ans = 0;
    rep(i, n) {
        int temp;
        temp = min(a[i], b[i]);
        ans += temp;
        b[i] -= temp;
        temp = min(a[i + 1], b[i]);
        a[i + 1] -= temp;
        ans += temp;
    }

    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N + 1);
    for (int i = 0; i < N + 1; i++) {
        scanf("%lld", &A[i]);
    }
    std::vector<long long> B(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &B[i]);
    }
    func(N, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 1792
def main():
    N=int(input())
    A=list(map(int, input().split()))
    B=list(map(int, input().split()))
    C=list(map(int, input().split()))
    prev_a = -1
    ans = 0
    for a in A:
        ans += B[a-1]
        if prev_a + 1 == a:
            ans += C[prev_a-1]
        prev_a = a
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
import java.util.*;

public class Main {
	double EPS = 10.e-08;
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			long sum = 0;
			if(n < 10) {
				System.out.println(n);
				continue;
			}
			sum += 9 - 1 + 1;
			if(n < 100){
				System.out.println(sum);
				continue;
			}
			
			if(n < 1000) {
				System.out.println(sum + (n - 100 + 1));
				continue;
			}
			sum += 999 - 100 + 1;
			if(n < 10000) {
				System.out.println(sum);
				continue;
			}
			
			if(n < 100000) {
				System.out.println(sum + (n - 10000 + 1));
			}
			else {
				System.out.println(sum + (n - 10000 + 1) - 1);
			}
			
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}


Measured memory_bytes: 24276
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long 
#define PB push_back
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define pii pair <int,  int>
#define pll pair <long long , long long>  
#define FAST ios::sync_with_stdio(false);cin.tie(0);
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const int maxn = 1e3 + 10 , S = 1e4 , N = 3e4 + 30 , sig = 2e4 , INF = 1e9 , mod = 1e9 + 7;

int main() {
    int a[5] = {};
    int ans = 0;
    for (int i = 0; i < 5; ++i) {
        cin >> a[i];
        if(a[i] == 0) {
            ans = i; 
        }
    }
    cout << ans + 1 << endl;
}

Measured memory_bytes: 3592
N, K = input().split()
N = int(N)
K = int(K)

if N % 2 == 0:
    # guusuu
    if (N / 2) >= K:
        print('YES')
    else:
        print('NO')
else:
    # kisuu
    if ((N / 2) + 0.5) >= K:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 2940
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val a = Vector.fill(n)(BigInt(sc.nextBigInteger()))

    val l = BigInt.apply("1000000000000000000")
    if (a.contains(BigInt(0))) {
      println(0)
    } else if (a.count(_ > l) > 0) {
      println(-1)
    } else {
      println(loop(0, BigInt(1)))
    }

    def loop(i: Int, s: BigInt): BigInt = {
      if (s > l) {
        BigInt(-1)
      } else if (i >= n) {
        s
      } else {
        loop(i + 1, s * a(i.toInt))
      }
    }

  }

}


Measured memory_bytes: 67544
#include <iostream>
#include <cmath>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <queue>
using namespace std;
typedef long long ll;

int main(void) {
    vector<ll> vec;
    ll n, y;
    ll i, j, k;
    cin >> n >> y;
    
    for(i=0; i<=min(y/10000, n); i++) {
        for(j=0; j<=min(y/5000, n); j++) {
            if(i+j<=n && 10000*i+5000*j+1000*(n-i-j)==y) {
                printf("%lld %lld %lld", i, j, n-i-j);
                return 0;
            }
        }
    }
    printf("-1 -1 -1\n");
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using ll = long long;
using namespace std;

void solve() {
   int n;
   cin >> n;
   string s;
   cin >> s;
   int x = 0, ans = 0;
   for(int i = 0; i < n; i++) {
      x += s[i] == 'I';
      x -= s[i] == 'D';
      ans = max(ans, x);
   }
   cout << ans << endl;
}

int main() {
   cin.tie(0);
   cin.sync_with_stdio(0);
   int testcase = 1;
   // cin >> testcase;
 
   for(int i = 0; i < testcase; i++) {
      solve();
   } 
   return 0;
}


Measured memory_bytes: 3588
process.stdin.resume();
process.stdin.setEncoding('utf8');
// ???????????????????¨??????§
// Let's ?????£??¬????????????
process.stdin.on('data', function (chunk) {
    var datas = chunk.split(/\n/);
     
    for (var i = 0; i < datas.length; i++) {
        var data = datas[i].split(' ').map(Number);
         
        if (data[0] === 0 && data[1] === 0) { break; }
         
        console.log(Math.min(data[0], data[1]) + " " + Math.max(data[0], data[1]));
    }
});

Measured memory_bytes: 18224
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    s = [input() for _ in range(n)]
    ans = 0
    back_a_count = 0
    front_b_count = 0
    front_b_back_a_count = 0

    for si in s:
        if si[0] == 'B':
            front_b_count += 1
        if si[-1] == 'A':
            back_a_count += 1
        if si[0] == 'B' and si[-1] == 'A':
            front_b_back_a_count += 1

        for j in range(len(si) - 1):
            if (si[j] == 'A' and si[j + 1] == 'B'):
                ans += 1

    ans += min(back_a_count, front_b_count)

    # See:
    # https://www.youtube.com/watch?v=AQOZYEk54rw
    if front_b_count == back_a_count == front_b_back_a_count:
        if front_b_back_a_count > 0:
            ans -= 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3700
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""
from collections import deque, defaultdict, Counter
import math
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


def main():
    N = int(input())
    A = wi()
    d = defaultdict(int)
    for i in range(0, N-1):
        d[A[i]] += 1
    # print(d)
    for i in range(N):
        print(d[i+1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 116044
import heapq

n, m = map(int, input().split())
prices = [-int(p) for p in input().split()]
heapq.heapify(prices)
for _ in range(m):
  p = heapq.heappop(prices)
  heapq.heappush(prices, p / 2)
print(-sum(int(p) for p in prices))

Measured memory_bytes: 14180
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j,k,l;
  int n,m;
  while(cin>>n>>m&&n+m){
    string t;
    getline(cin,t);
    int a[1000];
    memset(a,0,sizeof(a));
    string s[1000];
    for(i=0;i<n;i++){
      string t;
      getline(cin,t);
      for(;t[0]==' ';a[i]++)
	t.erase(0,1);
      s[i]=t;
    }
    for(i=0;i<m;i++){
      string t,u,v;
      cin>>t>>u>>u>>u>>v>>v;
      v.erase(v.length()-1,1);
      if(0){
      }else if(u[0]=='c'){
	for(j=0;s[j]!=t;j++);
	if(j==0)
	  cout<<"False"<<endl;
	else{
	  for(k=j;a[k]!=a[j]-1;k--);
	  if(s[k]==v)
	    cout<<"True"<<endl;
	  else
	    cout<<"False"<<endl;
	}
      }else if(u[0]=='p'){
	for(j=0;s[j]!=v;j++);
	if(j==0)
	  cout<<"False"<<endl;
	else{
	  for(k=j;a[k]!=a[j]-1;k--);
	  if(s[k]==t)
	    cout<<"True"<<endl;
	  else
	    cout<<"False"<<endl;
	}	
      }else if(u[0]=='s'){
	for(j=0;s[j]!=t&&s[j]!=v;j++);
	for(k=j+1;s[k]!=t&&s[k]!=v;k++);
	if(a[j]!=a[k])
	  cout<<"False"<<endl;
	else{
	  for(j++;j<k;j++){
	    if(a[j]<a[k])
	      break;
	  }
	  if(j==k)
	    cout<<"True"<<endl;
	  else
	    cout<<"False"<<endl;
	}
      }else if(u[0]=='d'){
	for(j=0;s[j]!=t;j++);
	l=a[j];
	for(k=j-1;k>-1;k--){
	  if(a[k]<l){
	    if(s[k]==v)
	      break;
	    l=a[k];
	  }
	}
	if(k==-1)
	  cout<<"False"<<endl;
	else
	  cout<<"True"<<endl;
      }else if(u[0]=='a'){
	for(j=0;s[j]!=v;j++);
	l=a[j];
	for(k=j-1;k>-1;k--){
	  if(a[k]<l){
	    if(s[k]==t)
	      break;
	    l=a[k];
	  }
	}
	if(k==-1)
	  cout<<"False"<<endl;
	else
	  cout<<"True"<<endl;
      }
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string s,t;
	cin>>s;
	for(auto it:s)
		if(it==',')cout<<" ";
	else cout<<it;

	return 0;
}

Measured memory_bytes: 256
N, K = list(map(int, input().split()))
h = [int(input()) for _ in range(N)]

hs = sorted(h)
ans = hs[-1] - hs[0]
for i in range(N - K + 1):
    ans = min(ans, hs[i+K-1]-hs[i])

print(ans)


Measured memory_bytes: 8280
#include <stdio.h>
#pragma warning(disable: 4996)

int main() {
	int w, h, x, y;
	scanf("%d %d %d %d", &w, &h, &x, &y);
	printf("%f %d", ((double)w * (double)h / 2.0), ((!(w % 2) & !(h % 2) & (x == w / 2) & (y == h / 2)) ? 1 : 0));
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>


int main()
{
    long long  n,m,k; std::cin >> n >> m >> k;
    // long long  a[n+1], b[m+1];
    std::vector<long long>  a(n+1), b(m+1);
    a.at(0)=0; b.at(0)=0;
    for (int i=1;i<n+1;i++)
        std::cin >> a.at(i);
    for (int i=1; i<m+1; i++)
        std::cin >> b.at(i);
    
    for (int i=1; i<n+1; i++)
        a.at(i)+=a.at(i-1);
    for (int i=1; i<m+1; i++)
        b.at(i)+=b.at(i-1);

    long long ans=0, r=m;
    for (int i=0; i<n+1; i++)
    {
        if(a.at(i)>k) break;
        while (a.at(i)+b.at(r)>k)
            r--;
        ans = std::max({ans, i+r});
    }
    
    std::cout << ans;

    return 0;
}

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

void main_()
{
    ll N;
    cin >> N;
    vector<int> as;
    as.reserve(N + 1);
    as.push_back(0); // 1-origin
    copy_n(istream_iterator<int>(cin), N, back_inserter(as));

    vector<int> balls(N + 1, 0); // 自分の倍数の箱の合計の偶奇
    vector<int> boxes_in_ball;
    for (int i = N; i >= 1; --i) {
        // ボールを入れるかどうかの選択
        if ((balls[i] ^ as[i]) == 0) {
            // 入れない
            continue;
        }
        // 入れる
        boxes_in_ball.push_back(i);
        for (int j = 1; j * j <= i; ++j) {
            if (i % j == 0) {
                balls[j] ^= 1;
                if (j * j != i) {
                    balls[i / j] ^= 1;
                }
            }
        }
    }

    cout << boxes_in_ball.size() << "\n";
    if (boxes_in_ball.size() > 0) {
        copy(rbegin(boxes_in_ball), rend(boxes_in_ball), ostream_iterator<int>(cout, " "));
        cout << "\n";
    }
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 3192
#include <iostream>
#include <string>

#define MAX_LEN (100)

using namespace std;

class Dice {
      private:
              int value[6];
              int top;
     
      public:             
              Dice(int value[]) {             
                   for (int i = 0; i < 6; i++) {
                        this->value[i] = value[i];
                   }
                   
                   this->top = value[0];
              }
              
              void swap(int& a, int& b) {
                   int temp = a;
                   a = b;
                   b = temp;
              }

              void move_N(int value[]) {
                   this->swap(value[0], value[1]);
                   this->swap(value[1], value[5]);
                   this->swap(value[5], value[4]);

                   this->top = value[0];
              }

              void move_E(int value[]) {
                   this->swap(value[0], value[3]);
                   this->swap(value[3], value[5]);
                   this->swap(value[5], value[2]);
 
                   this->top = value[0];
              }

              void move_W(int value[]) {
                   this->swap(value[0], value[2]);
                   this->swap(value[2], value[5]);
                   this->swap(value[5], value[3]);

                   this->top = value[0];
              }

              void move_S(int value[]) {
                   this->swap(value[0], value[4]);
                   this->swap(value[4], value[5]);
                   this->swap(value[5], value[1]);

                   this->top = value[0];
              }

              int Get_top() {
                  return (this->top);
              }
};

int main()
{
    int    value[6];  
    string inst;

    for (int i = 0; i < 6; i++) {
         do {
             cin >> value[i];
         } while (value[i] < 0 || value[i] > 100);
    }

    Dice dice(value);

    do {
        cin >> inst;
    } while (inst.length() < 0 || inst.length() > MAX_LEN);
        
    for (int i = 0; inst[i] != '\0'; i++){
         if (inst[i] == 'N') {
             dice.move_N(value);
         } else if (inst[i] == 'E') {
             dice.move_E(value);
         } else if (inst[i] == 'W') {
             dice.move_W(value);
         } else if (inst[i] == 'S') {
             dice.move_S(value);
         }
    }

    cout << dice.Get_top() << endl;

    return (0);
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int ans = 7;
  int k = 0;
  
  string s;
  cin >> s;
  
  int n=s.size();
  vector<int> A(n);
  
  for (int i = 0; i < n; i++) {
    A[i]=int(s.at(i))-int('0');
   // cout<<A[i]<<endl;
  }
  

  cout<<A[0];
 
 
  for (int tmp = 0; tmp < (1 << (n- 1)); tmp++) {
      //cout<<tmp<<endl;
       k=A[0];
      
    bitset<3> fugo(tmp); 
   
 
    // ビット列の1のビットに対応する所に+
   
    for (int i = 0; i < n-1; i++) {
       // cout<<fugo<<i<<" "<<k<<endl;
      if(fugo.test(i)){
          k-=A[i+1];
      }else{
          k+=A[i+1];
      }
      //cout<<i<<" "<<k<<" "<<ans<<endl;
    }
    if(k==ans){
          for (int i = 0; i < n-1; i++) {

            if(fugo.test(i)){
                 cout<<'-'<<A[i+1];
             }else{
                cout<<'+'<<A[i+1];
            }
    }
     goto OUT;
    }
    
    }
  
 OUT:
    cout<<"=7"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define in(n1) cin>>n1
#define lp(i,j,n) for(int i=j;i<=n;i++)
#define output(n1) cout<<n1<<endl
#define output2(n2) cout<<n2<<" "
#define ll long long 
#define ld long double
using namespace std;
int main()
{
  ll a,b;
 cin>>a>>b;
  cout<<a*b;
}

Measured memory_bytes: 3560
#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(n) begin(n),end(n)
using namespace std;
using P = pair<int, int>;
using ll =  long long;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];

    rep(i,n){
        if(a[i] == 0){
            cout << '0' << endl;
            return 0;
        }
    }
    ll ans = 1;
    ll mx = 1e18;
    rep(i,n){
        if(mx/ans < a[i]){
            cout << "-1" << endl;
            return 0;
        }
        ans *= a[i];
    }

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

Measured memory_bytes: 4044
import java.util.Arrays;

public class Main {


  private static void solve() {
    char[] s = ns();
    int n = s.length;
    int[] v = new int[n];
    int ptr =0;
    for (int i = 0; i < n; i ++) {
      if (s[i] == 'A') {
        v[ptr ++] = 1;
      } else if (i < n - 1 && s[i] == 'B' && s[i + 1] == 'C') {
        v[ptr ++] = 0;
        i ++;
      } else {
        v[ptr ++] = 2;
      }
    }
    
    long ret = 0;
    int one = 0;
    for (int i = 0; i < ptr; i ++) {
      if (v[i] == 1) {
        one ++;
      } else if (v[i] == 0) {
        ret += one;
      } else {
        one = 0;
      }
    }
    v = Arrays.copyOf(v, ptr);
    
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 27348
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e9;
signed main(){
	int S;cin>>S;
	cout<<0<<" "<<0<<endl;
	cout<<N<<" "<<1<<endl;
	int y3=S/N+bool(S%N);
	cout<<N*y3-S<<" "<<y3<<endl;
	return 0;
}

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


int main() {
  string S;
  cin >> S;
  int N = S.size();

  int ans = 0;
  for (int i = 0; i < N; i++) {
    int tmp_length = 0;
    for (int j = i; j < N; j++) {
      if (S[j] == 'A' || S[j] == 'C' || S[j] == 'G' || S[j] == 'T') {
        tmp_length++;
      } else {
        break;
      }   
    }
    ans = max(ans, tmp_length);
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3604
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var M = cin.ReadInt;
            var x = cin.ReadIntArray(M);

            if (M <= N)
            {
                Console.WriteLine(0);
                return;
            }

            x = x.OrderBy(_ => _).ToArray();
            var diff = x.Zip(x.Skip(1), (first, second) => second - first).OrderByDescending(_ => _);
            Console.WriteLine(x[M - 1] - x[0] - diff.Take(N - 1).Sum());
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}


Measured memory_bytes: 23904
#include <stdio.h>

int main(void)
{
    int E, Y;
    
    scanf("%d%d", &E, &Y);
    
    switch (E){
      case 0:
        if (Y <= 1911){
            printf("M%d\n", Y - 1867);
        }
        else if (Y <= 1925){
            printf("T%d\n", Y - 1911);
        }
        else if (Y <= 1988){
            printf("S%d\n", Y - 1925);
        }
        else{
            printf("H%d\n", Y - 1988);
        }
        break;
      
      case 1:
        printf("%d\n", Y + 1867);
        break;
      
      case 2:
        printf("%d\n", Y + 1911);
        break;
      
      case 3:
        printf("%d\n", Y + 1925);
        break;
      
      case 4:
        printf("%d\n", Y + 1988);
        break;
    }

    return (0);
}



Measured memory_bytes: 2104
object Main {
    def main(args : Array[String]) : Unit = {
        val input = io.StdIn.readLine().split(" ").map(_.toInt)
        var count = 0
        for (i <- input(0) to input(1)) {
            if ((input(2) % i) == 0)
                count += 1
        }
        println(count)
    }
}

Measured memory_bytes: 43896
A, B = map(int, input().split())

n = 10**6
for i in range(n):
    if int(i * 0.08) == A and int(i * 0.1) == B:
        print(i)
        exit()
    elif int(i * 0.08) > A or int(i * 0.01) > B:
        print(-1)
        exit()


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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool prime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

ll addmod(ll a,ll b)
{
    return (a+b)%mod;
}
ll mulmod(ll a,ll b)
{
    a %=mod;
    b%=mod;
    return (a*b)%mod;
}
ll submod(ll a,ll b)
{
    ll x  = a-b;
    if(x<0)x+=mod;
    x%=mod;
    return x;
}
bool comp(pair<pi,ll>a,pair<pi,ll>b)
{
    if(a.fi.fi==b.fi.fi)return a.fi.se<b.fi.se;
    return a.fi.fi<b.fi.fi;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    string s; cin>>s;
    reverse(all(s));
    ll n = s.size();
    vi arr(n);

    for(ll i=0;i<n;i++)
    {
        arr[i] = ((s[i]-'0')*modexp(10,i,2019))%2019;
    }
    vi pref(n);
    pref[0] = arr[0];
    rep(i,1,n)pref[i]= (pref[i-1]+arr[i])%2019;
    map<ll,ll>mp;
    ll ans = 0;
    for(ll i=0;i<n;i++)
    {
        if(pref[i]==0)ans++;
        ans+=mp[pref[i]];
        mp[pref[i]]++;
    }
    cout<<ans<<endl;
    return 0;
}
/*
5 10 10
22 23
17 19
13 17
8 12
2 6
*/


Measured memory_bytes: 6784
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;


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

	long long n;
	cin >> n;
	long long f[200][20], p[200][20];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < 5 * 2; j++)
			cin >> f[i][j];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < 11; j++)
			cin >> p[i][j];

	long long ans = -(1 << 30);
	for (int bit = 1; bit < (1 << 10); bit++) {
		long long t = 0;
		for (int i = 0; i < n; i++) {
			long long u = 0;
			for (int j = 0; j < 10; j++) {
				if ((bit >> j & 1) && f[i][j])
					u++;
			}
			t += p[i][u];
		}
		if (ans < t) ans = t;
	}
		
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
n,y = map(int, input().split())
a = -1
b = -1
c = -1
for i in range(n+1):
    for j in range(n+1-i):
        k = n-i-j
        sum = 10000*i + 5000*j + 1000*k
        if sum == y:
            a = i
            b = j
            c = k
                
print(a,b,c)

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

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

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

string s;

int main() {
  int n;
  S(n);
  cin >> s;
  int cnt = 0;
  rep(i,0,n) cnt += s[i] == 'E';
  int ans = n - 1;
  int cnt1 = 0;
  rep(i,0,n) {
    cnt -= s[i] == 'E';
    ans = min(ans, cnt + cnt1);
    cnt1 += s[i] == 'W';
  }
  P(ans);
  return 0;
}


Measured memory_bytes: 900
#include <bits/stdc++.h>
#include <set>
#include <vector>
using namespace std;
#define rep(i,n) for(ll i = 0; i < n; ++i)
#define Rep(i,j,n) for(ll i = j; i <= n; ++i)

#define yes "yes"
#define Yes "Yes"
#define no "no"
#define No "No"

namespace mydef
{
  void say(string some){
    cout << some << "\n";
  }
} // namespace mydef
using namespace mydef;
using P = pair<int,int>;
typedef long long ll;
const int INF = 1001001001;
const long double PI=3.14159265358979323846;

//ここから書く

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  string N;
  cin >> N;
  int sum = 0;

  rep(i, N.length()){
    sum += N[i]-48;
  }
  if(sum%9 == 0) say(Yes);
  else
  {
    say(No);
  }
  

  return 0;
}




Measured memory_bytes: 3780
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)                                                                             
#define seg_size 524288
int grid[1000][1000] = {};
int main() {
	int h, w, k;
	cin >> h >> w >> k;
	vector<string> hoge;
	REP(i, h) {
		string s;
		cin >> s;
		hoge.push_back(s);
	}
	queue<pair<int, int>> gogo;
	for (int i = 0;i < h;++i) {
		for (int q = 0;q < w;++q) {
			if (hoge[i][q] == 'S') {
				gogo.push(make_pair(i, q));
				grid[i][q] = k;
			}
		}
	}
	int ans = 10000;
	while (gogo.empty() == false) {
		pair<int, int> wow = gogo.front();
		gogo.pop();
		ans = min(ans, (wow.first + k - 1) / k);
		ans = min(ans, (wow.second - 1 + k) / k);
		ans = min(ans, (h - wow.first - 1 + k - 1) / k);
		ans = min(ans, (w - wow.second - 1 + k - 1) / k);
		if (ans == 0) break;
		if (grid[wow.first][wow.second] != 0) {
			if (grid[wow.first - 1][wow.second] == 0&&hoge[wow.first-1][wow.second] != '#') {
				grid[wow.first - 1][wow.second] = grid[wow.first][wow.second] - 1;
				gogo.push(make_pair(wow.first - 1, wow.second));
			}
			if (grid[wow.first + 1][wow.second] == 0 && hoge[wow.first + 1][wow.second] != '#') {
				grid[wow.first + 1][wow.second] = grid[wow.first][wow.second] - 1;
				gogo.push(make_pair(wow.first + 1, wow.second));
			}
			if (grid[wow.first][wow.second-1] == 0 && hoge[wow.first][wow.second-1] != '#') {
				grid[wow.first][wow.second-1] = grid[wow.first][wow.second] - 1;
				gogo.push(make_pair(wow.first, wow.second-1));
			}
			if (grid[wow.first][wow.second + 1] == 0 && hoge[wow.first][wow.second+1] != '#') {
				grid[wow.first][wow.second + 1] = grid[wow.first][wow.second] - 1;
				gogo.push(make_pair(wow.first, wow.second + 1));
			}
		}
	}
	cout << ans + 1 << endl;
	return 0;
}

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

const int mod = 1000000007;

int frac(int n){
  if (n == 0) return 1;
  int ret = (int64_t) n * frac(n - 1) % mod;
  return ret;
}

int modinv(int i){
  int x = 1, y = 0, z = 0, w = 1;
  int m = mod;
  while (m > 0){
    int q = i / m, r = i % m;
    int temp1 = x, temp2 = y;
    x = z; z = temp1 - q * z;
    y = w; w = temp2 - q * w;
    i = m; m = r;
  }
  while (x < 0) x += mod;
  return x % mod;
}

int comb(int n, int i){
  if (n < i) return 0;
  int a = frac(n), b = frac(i), c = frac(n - i);
  int d = (int64_t) b * c % mod;
  int ret = (int64_t) a * modinv(d) % mod;
  return ret;
}

int combh(int n, int i){
  return comb(n + i - 1, i);
}

int main(){
  int n, k; cin >> n >> k;
  for (int i = 1; i <= k; i++){
    int c = (int64_t) comb(n - k + 1, i) * combh(i, k - i) % mod;
    cout << c << endl;
  }
}

Measured memory_bytes: 256
n,p = map(int,input().split())
if n == 1:
    print(p)
    exit()
if n >=40:
    print(1)
    exit()
i =2
ans =1
while i**n <= p:
    if p%(i**n)==0:
        ans *= i
        p =p//(i**n)
 
    else:
        i += 1
print(ans)

Measured memory_bytes: 3060
#include<iostream>

using namespace std;

int main(){
  int c[4][4];
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> c[i][j];
    }
  }
  for(int i=0;i<3;i++){
    c[i][2]-=c[i][0];
    c[i][1]-=c[i][0];
    c[i][0]=0;
  }
  bool ans=true;
  for(int j=0;j<3;j++){
    if(c[0][j]!=c[1][j] || c[1][j]!=c[2][j]){
      ans=false;
      break;
    }
  }
  cout << (ans?"Yes": "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  long double k[n];
  rep(i,n)cin >> k[i];
  sort(k,k+n);
  long double ans=k[0];
  rep(i,n-1)ans=(ans+k[i+1])/2;
  cout << ans << endl;
}  


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<58;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vl l,r,len;

int main(){
	cin>>n;
	l=r=len=vl(n);
	multiset<ll> L,R;
	ll lx=0,rx=0,res=0;
	for(int i=0;i<n;i++){
		cin>>l[i]>>r[i];
		len[i]=r[i]-l[i];
	}
	L.insert(l[0]);
	R.insert(l[0]);
	for(int i=1;i<n;i++){
		 lx-=len[i];
		 rx+=len[i-1];
		 auto li=L.end(),ri=R.begin();
		 li--;
		 ll ls=*li+lx,rs=*ri+rx;
		 if(ls<=l[i]&&l[i]<=rs){
			 L.insert(l[i]-lx);
			 R.insert(l[i]-rx);
		 }
		 else if(l[i]<=ls){
			 L.insert(l[i]-lx);
			 L.insert(l[i]-lx);
			 L.erase(li);
			 R.insert(ls-rx);
			 res+=ls-l[i];
		 }
		 else{
			 R.insert(l[i]-rx);
			 R.insert(l[i]-rx);
			 R.erase(ri);
			 L.insert(rs-lx);
			 res+=l[i]-rs;
		 }
	}
	cout<<res<<endl;
}

Measured memory_bytes: 12032
#include<stdio.h>
int main ()
{
	int a,b,temp,i;
	scanf("%d%d",&a,&b);
	temp=a/b;
	for(i=1;temp!=0;)
    {
        i++;
        temp=temp/b;
    }
    printf("%d\n",i);


	return 0;
}


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

using namespace std;

int gcd(int a, int b) {
	while (b > 0) {
		int tmp = a % b;
		a = b;
		b = tmp;
	}
	return a;
}


void solve(int n) {
	if (n == 3) {
		cout << "2 5 63" << endl;
		return;
	}
	int save_n = n;
	
	vector<int> Two;
	vector<int> Three;
	vector<int> Four;
	vector<int> Zero;
	set<int> ans;
	
	ans.insert(2);
	ans.insert(3);
	
	n -= 2;
	
	for (int i = 4; i <= 30000; i++) {
		if ( i % 2 == 0 ) {
			if (i % 3 == 1)
				Four.push_back(i);
			else if ( i % 3 == 2 ){ 
				Two.push_back(i);
			}
			else if ( i % 3 == 0 ) {
				Zero.push_back(i);
			}
		}
		else if ( i % 3 == 0){
			Three.push_back(i);
		}
	}
	
	if (n == 19998) {
		ans.insert(Two.begin(), Two.end());
		ans.insert(Three.begin(), Three.end());
		ans.insert(Four.begin(), Four.end());
		ans.insert(Zero.begin(), Zero.end());
	}
	else {
		
		//same count of %3 == 1,2,0
		
		ans.insert(Three.back());
		Three.pop_back();
		n--;
		
		ans.insert(Four.back());
		Four.pop_back();
		n--;
		
		// now MOD 3 = 0
		// and sum is odd
		
		while (n >= 2 and Three.size() >= 2) {
			ans.insert(Three.back());
			Three.pop_back();
			ans.insert(Three.back());
			Three.pop_back();
			n-=2;
		}
		
		while(n >= 2 and Four.size() >= 1) {
			ans.insert(Four.back());
			ans.insert(Two.back());
			Four.pop_back();
			Two.pop_back();
			n -= 2;
		}
		
		while(n >= 1) {
			ans.insert(Zero.back());
			Zero.pop_back();
			n--;
		}
		
	}
	/*
	cout << "done " << save_n << endl;
	assert( (int)ans.size() == save_n);
	int d = *ans.begin();
	for (auto x : ans) {
		assert(x >= 1 and x <= 30000);
		d = gcd(d, x);
	}
	assert(d == 1);
	
	int sum = 0;
	for (auto x : ans) {
		sum += x;
	}
	
	for (auto x : ans) {
		assert( gcd(x,sum-x) > 1);
	}
	*/
	for (auto x : ans)
		cout << x << " ";
	cout << endl;
	
}

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


Measured memory_bytes: 1408
#include<iostream>
#define inf 1e9+1
using namespace std;
int dp[100005];
int n;
int a[100005];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	dp[n]=inf;
	for(int i=n-2;i>=0;i--){
		dp[i]=min(abs(a[i]-a[i+1])+dp[i+1],abs(a[i]-a[i+2])+dp[i+2]);
	}
	cout<<dp[0];
}

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

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

    vector<long long> s(n);
    for (int i = 0; i < n; i++) cin >> s[i];
    vector<long long> rev_s(n);
    rev_s = s;
    reverse(rev_s.begin(), rev_s.end());

    vector<vector<long long>> ans(n, vector<long long>(1, 0));

    for (int i = 1; i < n; i++){
        for (int j = i; j < n; j += i){
            if ((n-1) % i == 0 && j > ((n - 2) / 2)) break;
            if (j >= n - i - 1) break;
            ans[i].push_back(ans[i].back() + s[j] + rev_s[j]);
        }
    }
    long long a = 0;
    for (int i = 0; i < n; i++){
        int k = (int)ans[i].size();
        for (int j = 0; j < k; j++){
            a = max(a, ans[i][j]);
        }
    }

    cout << a << endl;

}


Measured memory_bytes: 16636
#入力取得
W, H, x, y = map(int, input().split())


max_s = W * H /2

if W % 2 == 0 and H % 2 == 0 and W/2 == x and H/2 == y:
    ans = 1
else:
    ans = 0


print(str(max_s) + " " + str(ans))


Measured memory_bytes: 2940
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define mset multiset
# define umap unordered_map
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)
# define lr(i,l,r) for(int i=l;(l>r?i>=r:i<=r);(l>r?--i:++i))

using namespace std;

template<class T> void umin(T &a, T b) { a = min(a, b); }
template<class T> void umax(T &a, T b) { a = max(a, b); }

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

const int mod = 1e9+7;
const int N = 2e5+5;

void solve(){
	int a,b;
	cin>>a>>b;
	int used[a+1],ans=0;
	for(int i=0;i<=a;++i)used[i]=0;
	for(int i=1;i<=a;++i){
		if(!used[i]){
			ans++;
			for(int j=i;j<=min(a,i+b+b);++j)
				used[j]=1;
		}
	}
	cout<<ans;

}

int main(){
	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)
		solve();
	return 0;
}

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

using namespace std;

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

	if ((A < C && C < B) || B < C && C < A) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

using namespace std;
using ll  = long long;
template <typename T> T In() {
    T t;
    cin >> t;
    return t;
}
template <typename T> vector<vector<T>> Vec2(int i, int j, T ini = 0) {
    vector<vector<T>> vec(i, vector<T>(j, ini));
    return move(vec);
}
template <typename T> vector<vector<vector<T>>> Vec3(int i, int j, int k, T ini = 0) {
    vector<vector<vector<T>>> vec(i, vector<vector<T>>(j, vector<T>(k, ini)));
    return move(vec);
}

int main() {
    auto S = In<string>();
    if     (S=="Sunny")    cout << "Cloudy"<< endl;
    else if(S=="Cloudy")   cout << "Rainy" << endl;
    else if(S=="Rainy")    cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b>c+d)
		printf("Left\n");
	else if(a+b<c+d)
		printf("Right\n");
	else
		printf("Balanced\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return (t * t) % mod;
    } else {
        return (modpow(m, n - 1) * m) % mod;
    }
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
struct LCA {
    vector<vector<int>> par;
    vector<int> d;
    int n;
    LCA(vector<vector<int>> graph, int root) {
        n = graph.size();
        par.resize(n, vector<int>(30));
        d.resize(n, 0);
        function<void(int, int, int)> dfs = [&](int c, int p, int depth) {
            d[c] = depth;
            par[c][0] = p;
            for (auto ch : graph[c]) {
                if (ch != p) dfs(ch, c, depth + 1);
            }
        };
        dfs(0, 0, 0);
        for (int j = 1; j < 30; j++) {
            REP(i, n) { par[i][j] = par[par[i][j - 1]][j - 1]; }
        }
    }
    int getdistance(int u, int v) { return (d[u] + d[v]) - 2 * (d[query(u, v)]); }
    int query(int u, int v) {
        if (d[u] > d[v]) {
            swap(u, v);
        }
        for (int i = 29; 0 <= i; i--) {
            if (d[u] <= d[par[v][i]]) {
                v = par[v][i];
            }
        }
        /* LCA */
        for (int i = 29; 0 <= i; i--) {
            if (par[v][i] != par[u][i]) {
                v = par[v][i];
                u = par[u][i];
            }
        }
        if (u == v) {
            return u;
        } else {
            return par[v][0];
        }
    }
};

struct UnionFind {
    vector<int> parent, size;
    UnionFind(int n) {
        parent.resize(n, -1);
        size.resize(n, 1);
    }
    void unite(int x, int y) {
        if (same(x, y)) {
            return;
        }
        x = root(x);
        y = root(y);
        if (size[x] <= size[y]) {
            swap(x, y);
        }
        parent[y] = x;
        size[x] += size[y];
    }
    bool same(int x, int y) { return (root(x) == root(y)); }
    int root(int x) {
        while (parent[x] != -1) {
            x = parent[x];
        }
        return x;
    }
    int getsize(int x) { return size[root(x)]; }
};
void aoj(vector<int> bs) {
    REP(i, bs.size() - 1) { cout << bs[i] << " "; }
    cout << bs[bs.size() - 1] << endl;
}

signed main() {
    string s;
    cin >> s;
    map<char, int> cnt;
    cnt[s[0]]++;
    cnt[s[1]]++;
    cnt[s[2]]++;
    if (cnt['a'] > 1) {
        cout << "No" << endl;
        return 0;
    }
    if (cnt['b'] > 1) {
        cout << "No" << endl;
        return 0;
    }
    if (cnt['c'] > 1) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
from bisect import bisect_left, bisect_right; from collections import Counter, defaultdict, deque, OrderedDict; from copy import deepcopy; from fractions import gcd; from functools import lru_cache, reduce; from math import ceil, floor; from sys import stdin, setrecursionlimit
import heapq as hq; import itertools as its; import operator as op


# globals
inf = float('inf')
input = stdin.readline


def main():
    n, l = get_li()
    tastes = list(range(l, l+n))
    print(sum(tastes) - min(tastes, key=lambda x: abs(x)))
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    setrecursionlimit(4100000)
    main()


Measured memory_bytes: 63980
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int64_t gcd(int64_t a, int64_t b) {
    if (a < b) {
        swap(a, b);
    }

    assert(a >= b);
    if (b == 0) {
        return a;
    }

    return gcd(b, a % b);
}

int main() {
    int64_t a, b;
    cin >> a >> b;

    cout << a * b / gcd(a, b) << endl;
}

Measured memory_bytes: 256